typia 5.5.7 → 5.5.8

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 (440) hide show
  1. package/lib/executable/TypiaSetupWizard.js.map +1 -1
  2. package/lib/factories/TypeFactory.js.map +1 -1
  3. package/lib/factories/internal/metadata/iterate_metadata.js +1 -1
  4. package/lib/factories/internal/metadata/iterate_metadata.js.map +1 -1
  5. package/lib/factories/internal/metadata/iterate_metadata_intersection.js.map +1 -1
  6. package/lib/factories/internal/metadata/iterate_metadata_sort.js.map +1 -1
  7. package/lib/functional/$FormDataReader/$FormDataReader.js.map +1 -1
  8. package/lib/functional/$HeadersReader/$HeadersReader.js.map +1 -1
  9. package/lib/functional/$ParameterReader/$ParameterReader.js.map +1 -1
  10. package/lib/functional/$ProtobufSizer.js.map +1 -1
  11. package/lib/functional/$QueryReader/$QueryReader.js.map +1 -1
  12. package/lib/programmers/AssertProgrammer.js +3 -1
  13. package/lib/programmers/AssertProgrammer.js.map +1 -1
  14. package/lib/programmers/CheckerProgrammer.js +1 -1
  15. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  16. package/lib/programmers/FeatureProgrammer.js.map +1 -1
  17. package/lib/programmers/RandomProgrammer.js.map +1 -1
  18. package/lib/programmers/TypiaProgrammer.js.map +1 -1
  19. package/lib/programmers/ValidateProgrammer.js +3 -1
  20. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  21. package/lib/programmers/functional/FunctionalIsParametersProgrammer.js +1 -1
  22. package/lib/programmers/functional/FunctionalIsParametersProgrammer.js.map +1 -1
  23. package/lib/programmers/functional/FunctionalIsReturnProgrammer.js +1 -1
  24. package/lib/programmers/functional/FunctionalIsReturnProgrammer.js.map +1 -1
  25. package/lib/programmers/http/HttpFormDataProgrammer.js.map +1 -1
  26. package/lib/programmers/http/HttpHeadersProgrammer.js.map +1 -1
  27. package/lib/programmers/http/HttpQueryProgrammer.js.map +1 -1
  28. package/lib/programmers/internal/application_constant.js.map +1 -1
  29. package/lib/programmers/internal/application_escaped.js.map +1 -1
  30. package/lib/programmers/internal/application_object.js +3 -1
  31. package/lib/programmers/internal/application_object.js.map +1 -1
  32. package/lib/programmers/internal/check_dynamic_key.js.map +1 -1
  33. package/lib/programmers/internal/check_number.js +2 -1
  34. package/lib/programmers/internal/check_number.js.map +1 -1
  35. package/lib/programmers/internal/check_object.js.map +1 -1
  36. package/lib/programmers/internal/feature_object_entries.js.map +1 -1
  37. package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
  38. package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
  39. package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
  40. package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
  41. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +6 -2
  42. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
  43. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
  44. package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -1
  45. package/lib/transformers/features/AssertTransformer.js.map +1 -1
  46. package/lib/transformers/features/CreateAssertTransformer.js.map +1 -1
  47. package/lib/transformers/features/functional/FunctionalGenericTransformer.js +1 -1
  48. package/lib/transformers/features/functional/FunctionalGenericTransformer.js.map +1 -1
  49. package/package.json +2 -2
  50. package/src/AssertionGuard.ts +1 -1
  51. package/src/CamelCase.ts +65 -62
  52. package/src/IRandomGenerator.ts +62 -62
  53. package/src/IValidation.ts +21 -21
  54. package/src/PascalCase.ts +65 -62
  55. package/src/Primitive.ts +48 -47
  56. package/src/Resolved.ts +61 -60
  57. package/src/SnakeCase.ts +67 -64
  58. package/src/TypeGuardError.ts +36 -36
  59. package/src/executable/TypiaGenerateWizard.ts +83 -83
  60. package/src/executable/TypiaPatchWizard.ts +42 -42
  61. package/src/executable/TypiaSetupWizard.ts +4 -4
  62. package/src/executable/setup/ArgumentParser.ts +43 -43
  63. package/src/executable/setup/CommandExecutor.ts +8 -8
  64. package/src/executable/setup/FileRetriever.ts +22 -22
  65. package/src/executable/setup/PackageManager.ts +71 -71
  66. package/src/executable/setup/PluginConfigurator.ts +69 -69
  67. package/src/executable/typia.ts +55 -55
  68. package/src/factories/CommentFactory.ts +79 -79
  69. package/src/factories/ExpressionFactory.ts +150 -150
  70. package/src/factories/IdentifierFactory.ts +70 -70
  71. package/src/factories/JsonMetadataFactory.ts +53 -53
  72. package/src/factories/LiteralFactory.ts +47 -47
  73. package/src/factories/MetadataCollection.ts +260 -260
  74. package/src/factories/MetadataCommentTagFactory.ts +516 -516
  75. package/src/factories/MetadataFactory.ts +267 -267
  76. package/src/factories/MetadataTypeTagFactory.ts +332 -332
  77. package/src/factories/MetadataTypeTagSchemaFactory.ts +58 -58
  78. package/src/factories/NumericRangeFactory.ts +72 -72
  79. package/src/factories/ProtobufFactory.ts +267 -267
  80. package/src/factories/StatementFactory.ts +72 -72
  81. package/src/factories/TemplateFactory.ts +56 -56
  82. package/src/factories/TypeFactory.ts +14 -14
  83. package/src/factories/ValueFactory.ts +12 -12
  84. package/src/factories/internal/metadata/MetadataHelper.ts +15 -15
  85. package/src/factories/internal/metadata/emend_metadata_atomics.ts +46 -46
  86. package/src/factories/internal/metadata/emplace_metadata_alias.ts +41 -41
  87. package/src/factories/internal/metadata/emplace_metadata_array_type.ts +38 -38
  88. package/src/factories/internal/metadata/emplace_metadata_object.ts +176 -176
  89. package/src/factories/internal/metadata/emplace_metadata_tuple.ts +57 -57
  90. package/src/factories/internal/metadata/explore_metadata.ts +28 -28
  91. package/src/factories/internal/metadata/iterate_metadata.ts +1 -1
  92. package/src/factories/internal/metadata/iterate_metadata_alias.ts +34 -34
  93. package/src/factories/internal/metadata/iterate_metadata_array.ts +70 -70
  94. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
  95. package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
  96. package/src/factories/internal/metadata/iterate_metadata_collection.ts +131 -131
  97. package/src/factories/internal/metadata/iterate_metadata_comment_tags.ts +26 -26
  98. package/src/factories/internal/metadata/iterate_metadata_constant.ts +48 -48
  99. package/src/factories/internal/metadata/iterate_metadata_escape.ts +52 -52
  100. package/src/factories/internal/metadata/iterate_metadata_intersection.ts +2 -2
  101. package/src/factories/internal/metadata/iterate_metadata_map.ts +50 -50
  102. package/src/factories/internal/metadata/iterate_metadata_native.ts +209 -209
  103. package/src/factories/internal/metadata/iterate_metadata_object.ts +33 -33
  104. package/src/factories/internal/metadata/iterate_metadata_set.ts +41 -41
  105. package/src/factories/internal/metadata/iterate_metadata_sort.ts +2 -2
  106. package/src/factories/internal/metadata/iterate_metadata_template.ts +44 -44
  107. package/src/factories/internal/metadata/iterate_metadata_tuple.ts +37 -37
  108. package/src/factories/internal/metadata/iterate_metadata_union.ts +27 -27
  109. package/src/functional/$FormDataReader/$FormDataReader.ts +30 -30
  110. package/src/functional/$FormDataReader/index.ts +1 -1
  111. package/src/functional/$HeadersReader/$HeadersReader.ts +2 -2
  112. package/src/functional/$HeadersReader/index.ts +1 -1
  113. package/src/functional/$ParameterReader/$ParameterReader.ts +2 -2
  114. package/src/functional/$ParameterReader/index.ts +1 -1
  115. package/src/functional/$ProtobufReader.ts +195 -195
  116. package/src/functional/$ProtobufSizer.ts +8 -8
  117. package/src/functional/$ProtobufWriter.ts +150 -150
  118. package/src/functional/$QueryReader/$QueryReader.ts +8 -8
  119. package/src/functional/$QueryReader/index.ts +1 -1
  120. package/src/functional/$any.ts +4 -4
  121. package/src/functional/$clone.ts +4 -4
  122. package/src/functional/$convention.ts +37 -37
  123. package/src/functional/$dictionary.ts +22 -22
  124. package/src/functional/$every.ts +11 -11
  125. package/src/functional/$guard.ts +21 -21
  126. package/src/functional/$is_between.ts +2 -2
  127. package/src/functional/$join.ts +46 -46
  128. package/src/functional/$number.ts +12 -12
  129. package/src/functional/$report.ts +13 -13
  130. package/src/functional/$rest.ts +3 -3
  131. package/src/functional/$stoll.ts +8 -8
  132. package/src/functional/$string.ts +43 -43
  133. package/src/functional/$strlen.ts +7 -7
  134. package/src/functional/$tail.ts +5 -5
  135. package/src/functional/$throws.ts +10 -10
  136. package/src/functional/$varint.ts +130 -130
  137. package/src/functional/$zigzag.ts +39 -39
  138. package/src/functional/IProtobufWriter.ts +18 -18
  139. package/src/functional/Namespace/functional.ts +5 -5
  140. package/src/functional/Namespace/http.ts +9 -9
  141. package/src/functional/Namespace/index.ts +76 -76
  142. package/src/functional/Namespace/json.ts +15 -15
  143. package/src/functional/Namespace/misc.ts +14 -14
  144. package/src/functional/Namespace/notations.ts +23 -23
  145. package/src/functional/Namespace/protobuf.ts +20 -20
  146. package/src/functional/is.ts +10 -10
  147. package/src/functional.ts +872 -872
  148. package/src/http.ts +1266 -1266
  149. package/src/index.ts +4 -4
  150. package/src/json.ts +754 -754
  151. package/src/misc.ts +757 -757
  152. package/src/module.ts +1024 -1024
  153. package/src/notations.ts +1020 -1020
  154. package/src/programmers/AssertProgrammer.ts +40 -38
  155. package/src/programmers/CheckerProgrammer.ts +3 -3
  156. package/src/programmers/FeatureProgrammer.ts +27 -27
  157. package/src/programmers/RandomProgrammer.ts +12 -12
  158. package/src/programmers/TypiaProgrammer.ts +6 -6
  159. package/src/programmers/ValidateProgrammer.ts +40 -38
  160. package/src/programmers/functional/FunctionalAssertFunctionProgrammer.ts +130 -130
  161. package/src/programmers/functional/FunctionalAssertParametersProgrammer.ts +81 -81
  162. package/src/programmers/functional/FunctionalAssertReturnProgrammer.ts +77 -77
  163. package/src/programmers/functional/FunctionalIsFunctionProgrammer.ts +61 -61
  164. package/src/programmers/functional/FunctionalIsParametersProgrammer.ts +1 -1
  165. package/src/programmers/functional/FunctionalIsReturnProgrammer.ts +1 -1
  166. package/src/programmers/functional/FunctionalValidateFunctionProgrammer.ts +113 -113
  167. package/src/programmers/functional/FunctionalValidateParametersProgrammer.ts +203 -203
  168. package/src/programmers/functional/FunctionalValidateReturnProgrammer.ts +107 -107
  169. package/src/programmers/functional/internal/FunctionalGeneralProgrammer.ts +32 -32
  170. package/src/programmers/helpers/AtomicPredicator.ts +24 -24
  171. package/src/programmers/helpers/CloneJoiner.ts +130 -130
  172. package/src/programmers/helpers/FunctionImporeter.ts +1 -1
  173. package/src/programmers/helpers/FunctionImporter.ts +87 -87
  174. package/src/programmers/helpers/HttpMetadataUtil.ts +21 -21
  175. package/src/programmers/helpers/ICheckEntry.ts +13 -13
  176. package/src/programmers/helpers/IExpressionEntry.ts +12 -12
  177. package/src/programmers/helpers/NotationJoiner.ts +132 -132
  178. package/src/programmers/helpers/OptionPredicator.ts +15 -15
  179. package/src/programmers/helpers/ProtobufUtil.ts +125 -125
  180. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  181. package/src/programmers/helpers/PruneJoiner.ts +141 -141
  182. package/src/programmers/helpers/RandomJoiner.ts +140 -140
  183. package/src/programmers/helpers/RandomRanger.ts +171 -171
  184. package/src/programmers/helpers/StringifyJoinder.ts +105 -105
  185. package/src/programmers/helpers/StringifyPredicator.ts +12 -12
  186. package/src/programmers/helpers/UnionExplorer.ts +269 -269
  187. package/src/programmers/helpers/UnionPredicator.ts +77 -77
  188. package/src/programmers/helpers/disable_function_importer_declare.ts +2 -2
  189. package/src/programmers/http/HttpAssertFormDataProgrammer.ts +87 -87
  190. package/src/programmers/http/HttpAssertHeadersProgrammer.ts +89 -89
  191. package/src/programmers/http/HttpAssertQueryProgrammer.ts +87 -87
  192. package/src/programmers/http/HttpFormDataProgrammer.ts +21 -20
  193. package/src/programmers/http/HttpHeadersProgrammer.ts +13 -12
  194. package/src/programmers/http/HttpIsFormDataProgrammer.ts +90 -90
  195. package/src/programmers/http/HttpIsHeadersProgrammer.ts +92 -92
  196. package/src/programmers/http/HttpIsQueryProgrammer.ts +90 -90
  197. package/src/programmers/http/HttpParameterProgrammer.ts +97 -97
  198. package/src/programmers/http/HttpQueryProgrammer.ts +13 -12
  199. package/src/programmers/http/HttpValidateFormDataProgrammer.ts +75 -75
  200. package/src/programmers/http/HttpValidateHeadersProgrammer.ts +77 -77
  201. package/src/programmers/http/HttpValidateQueryProgrammer.ts +75 -75
  202. package/src/programmers/internal/JSON_SCHEMA_PREFIX.ts +1 -1
  203. package/src/programmers/internal/application_alias.ts +74 -74
  204. package/src/programmers/internal/application_array.ts +63 -63
  205. package/src/programmers/internal/application_boolean.ts +44 -44
  206. package/src/programmers/internal/application_constant.ts +4 -4
  207. package/src/programmers/internal/application_default.ts +17 -17
  208. package/src/programmers/internal/application_default_string.ts +33 -33
  209. package/src/programmers/internal/application_escaped.ts +2 -2
  210. package/src/programmers/internal/application_native.ts +40 -40
  211. package/src/programmers/internal/application_number.ts +98 -98
  212. package/src/programmers/internal/application_object.ts +9 -7
  213. package/src/programmers/internal/application_schema.ts +165 -165
  214. package/src/programmers/internal/application_string.ts +65 -65
  215. package/src/programmers/internal/application_templates.ts +24 -24
  216. package/src/programmers/internal/application_tuple.ts +54 -54
  217. package/src/programmers/internal/check_array_length.ts +45 -45
  218. package/src/programmers/internal/check_bigint.ts +49 -49
  219. package/src/programmers/internal/check_dynamic_key.ts +2 -2
  220. package/src/programmers/internal/check_dynamic_properties.ts +211 -211
  221. package/src/programmers/internal/check_everything.ts +23 -23
  222. package/src/programmers/internal/check_native.ts +21 -21
  223. package/src/programmers/internal/check_number.ts +35 -34
  224. package/src/programmers/internal/check_object.ts +5 -4
  225. package/src/programmers/internal/check_string.ts +48 -48
  226. package/src/programmers/internal/check_template.ts +61 -61
  227. package/src/programmers/internal/check_union_array_like.ts +307 -307
  228. package/src/programmers/internal/decode_union_object.ts +99 -99
  229. package/src/programmers/internal/feature_object_entries.ts +8 -8
  230. package/src/programmers/internal/metadata_to_pattern.ts +33 -33
  231. package/src/programmers/internal/prune_object_properties.ts +60 -60
  232. package/src/programmers/internal/random_custom.ts +37 -37
  233. package/src/programmers/internal/stringify_dynamic_properties.ts +157 -157
  234. package/src/programmers/internal/stringify_native.ts +7 -7
  235. package/src/programmers/internal/stringify_regular_properties.ts +81 -81
  236. package/src/programmers/internal/template_to_pattern.ts +15 -15
  237. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +20 -20
  238. package/src/programmers/json/JsonApplicationProgrammer.ts +1 -1
  239. package/src/programmers/json/JsonAssertParseProgrammer.ts +81 -81
  240. package/src/programmers/json/JsonAssertStringifyProgrammer.ts +67 -67
  241. package/src/programmers/json/JsonIsParseProgrammer.ts +81 -81
  242. package/src/programmers/json/JsonIsStringifyProgrammer.ts +75 -75
  243. package/src/programmers/json/JsonStringifyProgrammer.ts +15 -11
  244. package/src/programmers/json/JsonValidateParseProgrammer.ts +64 -64
  245. package/src/programmers/json/JsonValidateStringifyProgrammer.ts +83 -83
  246. package/src/programmers/misc/MiscAssertCloneProgrammer.ts +77 -77
  247. package/src/programmers/misc/MiscAssertPruneProgrammer.ts +66 -66
  248. package/src/programmers/misc/MiscCloneProgrammer.ts +8 -8
  249. package/src/programmers/misc/MiscIsCloneProgrammer.ts +78 -78
  250. package/src/programmers/misc/MiscIsPruneProgrammer.ts +66 -66
  251. package/src/programmers/misc/MiscLiteralsProgrammer.ts +8 -8
  252. package/src/programmers/misc/MiscPruneProgrammer.ts +523 -523
  253. package/src/programmers/misc/MiscValidateCloneProgrammer.ts +80 -80
  254. package/src/programmers/misc/MiscValidatePruneProgrammer.ts +73 -73
  255. package/src/programmers/notations/NotationAssertGeneralProgrammer.ts +70 -70
  256. package/src/programmers/notations/NotationGeneralProgrammer.ts +647 -647
  257. package/src/programmers/notations/NotationIsGeneralProgrammer.ts +71 -71
  258. package/src/programmers/notations/NotationValidateGeneralProgrammer.ts +81 -81
  259. package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +87 -87
  260. package/src/programmers/protobuf/ProtobufAssertEncodeProgrammer.ts +67 -67
  261. package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +35 -31
  262. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +46 -46
  263. package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +90 -90
  264. package/src/programmers/protobuf/ProtobufIsEncodeProgrammer.ts +75 -75
  265. package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +2 -2
  266. package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +75 -75
  267. package/src/programmers/protobuf/ProtobufValidateEncodeProgrammer.ts +83 -83
  268. package/src/protobuf.ts +999 -999
  269. package/src/reflect.ts +57 -57
  270. package/src/schemas/json/IJsonApplication.ts +9 -9
  271. package/src/schemas/json/IJsonComponents.ts +19 -19
  272. package/src/schemas/json/IJsonSchema.ts +147 -147
  273. package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
  274. package/src/schemas/metadata/IMetadata.ts +34 -34
  275. package/src/schemas/metadata/IMetadataAlias.ts +12 -12
  276. package/src/schemas/metadata/IMetadataApplication.ts +7 -7
  277. package/src/schemas/metadata/IMetadataArray.ts +7 -7
  278. package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
  279. package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
  280. package/src/schemas/metadata/IMetadataComponents.ts +11 -11
  281. package/src/schemas/metadata/IMetadataConstant.ts +23 -23
  282. package/src/schemas/metadata/IMetadataDictionary.ts +11 -11
  283. package/src/schemas/metadata/IMetadataEntry.ts +6 -6
  284. package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
  285. package/src/schemas/metadata/IMetadataObject.ts +13 -13
  286. package/src/schemas/metadata/IMetadataProperty.ts +9 -9
  287. package/src/schemas/metadata/IMetadataTuple.ts +7 -7
  288. package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
  289. package/src/schemas/metadata/IMetadataTypeTag.ts +16 -16
  290. package/src/schemas/metadata/Metadata.ts +631 -631
  291. package/src/schemas/metadata/MetadataAlias.ts +61 -61
  292. package/src/schemas/metadata/MetadataApplication.ts +44 -44
  293. package/src/schemas/metadata/MetadataArray.ts +49 -49
  294. package/src/schemas/metadata/MetadataArrayType.ts +57 -57
  295. package/src/schemas/metadata/MetadataAtomic.ts +85 -85
  296. package/src/schemas/metadata/MetadataComponents.ts +98 -98
  297. package/src/schemas/metadata/MetadataConstant.ts +46 -46
  298. package/src/schemas/metadata/MetadataEscaped.ts +51 -51
  299. package/src/schemas/metadata/MetadataObject.ts +154 -154
  300. package/src/schemas/metadata/MetadataProperty.ts +56 -56
  301. package/src/schemas/metadata/MetadataTuple.ts +32 -32
  302. package/src/schemas/metadata/MetadataTupleType.ts +67 -67
  303. package/src/tags/Default.ts +18 -18
  304. package/src/tags/ExclusiveMaximum.ts +19 -19
  305. package/src/tags/ExclusiveMinimum.ts +19 -19
  306. package/src/tags/Format.ts +16 -16
  307. package/src/tags/MaxItems.ts +12 -12
  308. package/src/tags/MaxLength.ts +12 -12
  309. package/src/tags/Maximum.ts +18 -18
  310. package/src/tags/MinItems.ts +12 -12
  311. package/src/tags/MinLength.ts +12 -12
  312. package/src/tags/Minimum.ts +18 -18
  313. package/src/tags/MultipleOf.ts +20 -20
  314. package/src/tags/Pattern.ts +12 -12
  315. package/src/tags/TagBase.ts +76 -76
  316. package/src/tags/Type.ts +14 -14
  317. package/src/tags/index.ts +14 -14
  318. package/src/tags/internal/FormatCheatSheet.ts +71 -71
  319. package/src/transform.ts +35 -35
  320. package/src/transformers/CallExpressionTransformer.ts +496 -496
  321. package/src/transformers/FileTransformer.ts +91 -91
  322. package/src/transformers/IProject.ts +15 -15
  323. package/src/transformers/ITransformOptions.ts +62 -62
  324. package/src/transformers/ImportTransformer.ts +66 -66
  325. package/src/transformers/NodeTransformer.ts +13 -13
  326. package/src/transformers/TransformerError.ts +55 -55
  327. package/src/transformers/features/AssertTransformer.ts +2 -2
  328. package/src/transformers/features/CreateAssertTransformer.ts +2 -2
  329. package/src/transformers/features/CreateIsTransformer.ts +10 -10
  330. package/src/transformers/features/CreateRandomTransformer.ts +40 -40
  331. package/src/transformers/features/CreateValidateTransformer.ts +13 -13
  332. package/src/transformers/features/IsTransformer.ts +10 -10
  333. package/src/transformers/features/RandomTransformer.ts +44 -44
  334. package/src/transformers/features/ValidateTransformer.ts +11 -11
  335. package/src/transformers/features/functional/FunctionalGenericTransformer.ts +3 -1
  336. package/src/transformers/features/http/CreateHttpAssertFormDataTransformer.ts +12 -12
  337. package/src/transformers/features/http/CreateHttpAssertHeadersTransformer.ts +11 -11
  338. package/src/transformers/features/http/CreateHttpAssertQueryTransformer.ts +9 -9
  339. package/src/transformers/features/http/CreateHttpFormDataTransformer.ts +9 -9
  340. package/src/transformers/features/http/CreateHttpHeadersTransformer.ts +9 -9
  341. package/src/transformers/features/http/CreateHttpIsFormDataTransformer.ts +9 -9
  342. package/src/transformers/features/http/CreateHttpIsHeadersTransformer.ts +9 -9
  343. package/src/transformers/features/http/CreateHttpIsQueryTransformer.ts +9 -9
  344. package/src/transformers/features/http/CreateHttpParameterTransformer.ts +9 -9
  345. package/src/transformers/features/http/CreateHttpQueryTransformer.ts +9 -9
  346. package/src/transformers/features/http/CreateHttpValidateFormDataTransformer.ts +12 -12
  347. package/src/transformers/features/http/CreateHttpValidateHeadersTransformer.ts +12 -12
  348. package/src/transformers/features/http/CreateHttpValidateQueryTransformer.ts +11 -11
  349. package/src/transformers/features/http/HttpAssertFormDataTransformer.ts +10 -10
  350. package/src/transformers/features/http/HttpAssertHeadersTransformer.ts +9 -9
  351. package/src/transformers/features/http/HttpAssertQueryTransformer.ts +9 -9
  352. package/src/transformers/features/http/HttpFormDataTransformer.ts +9 -9
  353. package/src/transformers/features/http/HttpHeadersTransformer.ts +9 -9
  354. package/src/transformers/features/http/HttpIsFormDataTransformer.ts +9 -9
  355. package/src/transformers/features/http/HttpIsHeadersTransformer.ts +9 -9
  356. package/src/transformers/features/http/HttpIsQueryTransformer.ts +9 -9
  357. package/src/transformers/features/http/HttpParameterTransformer.ts +9 -9
  358. package/src/transformers/features/http/HttpQueryTransformer.ts +9 -9
  359. package/src/transformers/features/http/HttpValidateFormDataTransformer.ts +10 -10
  360. package/src/transformers/features/http/HttpValidateHeadersTransformer.ts +10 -10
  361. package/src/transformers/features/http/HttpValidateQueryTransformer.ts +9 -9
  362. package/src/transformers/features/json/JsonApplicationTransformer.ts +133 -133
  363. package/src/transformers/features/json/JsonAssertParseTransformer.ts +9 -9
  364. package/src/transformers/features/json/JsonAssertStringifyTransformer.ts +10 -10
  365. package/src/transformers/features/json/JsonCreateAssertParseTransformer.ts +9 -9
  366. package/src/transformers/features/json/JsonCreateAssertStringifyTransformer.ts +12 -12
  367. package/src/transformers/features/json/JsonCreateIsParseTransformer.ts +9 -9
  368. package/src/transformers/features/json/JsonCreateIsStringifyTransformer.ts +9 -9
  369. package/src/transformers/features/json/JsonCreateStringifyTransformer.ts +9 -9
  370. package/src/transformers/features/json/JsonCreateValidateParseTransformer.ts +11 -11
  371. package/src/transformers/features/json/JsonCreateValidateStringifyProgrammer.ts +12 -12
  372. package/src/transformers/features/json/JsonIsParseTransformer.ts +9 -9
  373. package/src/transformers/features/json/JsonIsStringifyTransformer.ts +9 -9
  374. package/src/transformers/features/json/JsonStringifyTransformer.ts +9 -9
  375. package/src/transformers/features/json/JsonValidateParseTransformer.ts +9 -9
  376. package/src/transformers/features/json/JsonValidateStringifyTransformer.ts +10 -10
  377. package/src/transformers/features/misc/MiscAssertCloneTransformer.ts +9 -9
  378. package/src/transformers/features/misc/MiscAssertPruneTransformer.ts +9 -9
  379. package/src/transformers/features/misc/MiscCloneTransformer.ts +9 -9
  380. package/src/transformers/features/misc/MiscCreateAssertCloneTransformer.ts +9 -9
  381. package/src/transformers/features/misc/MiscCreateAssertPruneTransformer.ts +9 -9
  382. package/src/transformers/features/misc/MiscCreateCloneTransformer.ts +9 -9
  383. package/src/transformers/features/misc/MiscCreateIsCloneTransformer.ts +9 -9
  384. package/src/transformers/features/misc/MiscCreateIsPruneTransformer.ts +9 -9
  385. package/src/transformers/features/misc/MiscCreatePruneTransformer.ts +9 -9
  386. package/src/transformers/features/misc/MiscCreateValidateCloneTransformer.ts +11 -11
  387. package/src/transformers/features/misc/MiscCreateValidatePruneTransformer.ts +11 -11
  388. package/src/transformers/features/misc/MiscIsCloneTransformer.ts +9 -9
  389. package/src/transformers/features/misc/MiscIsPruneTransformer.ts +9 -9
  390. package/src/transformers/features/misc/MiscLiteralsTransformer.ts +32 -32
  391. package/src/transformers/features/misc/MiscPruneTransformer.ts +9 -9
  392. package/src/transformers/features/misc/MiscValidateCloneTransformer.ts +9 -9
  393. package/src/transformers/features/misc/MiscValidatePruneTransformer.ts +9 -9
  394. package/src/transformers/features/notations/NotationAssertGeneralTransformer.ts +15 -15
  395. package/src/transformers/features/notations/NotationCreateAssertGeneralTransformer.ts +15 -15
  396. package/src/transformers/features/notations/NotationCreateGeneralTransformer.ts +15 -15
  397. package/src/transformers/features/notations/NotationCreateIsGeneralTransformer.ts +15 -15
  398. package/src/transformers/features/notations/NotationCreateValidateGeneralTransformer.ts +15 -15
  399. package/src/transformers/features/notations/NotationGeneralTransformer.ts +11 -11
  400. package/src/transformers/features/notations/NotationIsGeneralTransformer.ts +15 -15
  401. package/src/transformers/features/notations/NotationValidateGeneralTransformer.ts +15 -15
  402. package/src/transformers/features/protobuf/ProtobufAssertDecodeTransformer.ts +10 -10
  403. package/src/transformers/features/protobuf/ProtobufAssertEncodeTransformer.ts +10 -10
  404. package/src/transformers/features/protobuf/ProtobufCreateAssertDecodeTransformer.ts +12 -12
  405. package/src/transformers/features/protobuf/ProtobufCreateAssertEncodeTransformer.ts +12 -12
  406. package/src/transformers/features/protobuf/ProtobufCreateDecodeTransformer.ts +9 -9
  407. package/src/transformers/features/protobuf/ProtobufCreateEncodeTransformer.ts +9 -9
  408. package/src/transformers/features/protobuf/ProtobufCreateIsDecodeTransformer.ts +9 -9
  409. package/src/transformers/features/protobuf/ProtobufCreateIsEncodeTransformer.ts +9 -9
  410. package/src/transformers/features/protobuf/ProtobufCreateValidateDecodeTransformer.ts +12 -12
  411. package/src/transformers/features/protobuf/ProtobufCreateValidateEncodeTransformer.ts +12 -12
  412. package/src/transformers/features/protobuf/ProtobufDecodeTransformer.ts +9 -9
  413. package/src/transformers/features/protobuf/ProtobufEncodeTransformer.ts +9 -9
  414. package/src/transformers/features/protobuf/ProtobufIsDecodeTransformer.ts +9 -9
  415. package/src/transformers/features/protobuf/ProtobufIsEncodeTransformer.ts +9 -9
  416. package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +33 -33
  417. package/src/transformers/features/protobuf/ProtobufValidateDecodeTransformer.ts +10 -10
  418. package/src/transformers/features/protobuf/ProtobufValidateEncodeTransformer.ts +10 -10
  419. package/src/transformers/features/reflect/ReflectMetadataTransformer.ts +63 -63
  420. package/src/transformers/internal/GenericTransformer.ts +104 -104
  421. package/src/typings/Atomic.ts +13 -13
  422. package/src/typings/ClassProperties.ts +5 -5
  423. package/src/typings/Customizable.ts +5 -5
  424. package/src/typings/OmitNever.ts +3 -3
  425. package/src/typings/ProtobufAtomic.ts +19 -19
  426. package/src/typings/SpecialFields.ts +3 -3
  427. package/src/typings/ValidationPipe.ts +9 -9
  428. package/src/typings/Writable.ts +11 -11
  429. package/src/utils/ArrayUtil.ts +43 -43
  430. package/src/utils/Escaper.ts +46 -46
  431. package/src/utils/MapUtil.ts +12 -12
  432. package/src/utils/NameEncoder.ts +32 -32
  433. package/src/utils/NamingConvention/NamingConvention.ts +86 -86
  434. package/src/utils/NamingConvention/index.ts +1 -1
  435. package/src/utils/PatternUtil.ts +29 -29
  436. package/src/utils/RandomGenerator/RandomGenerator.ts +105 -105
  437. package/src/utils/RandomGenerator/index.ts +1 -1
  438. package/src/utils/Singleton.ts +16 -16
  439. package/src/utils/StringUtil/StringUtil.ts +7 -7
  440. package/src/utils/StringUtil/index.ts +1 -1
package/src/protobuf.ts CHANGED
@@ -1,999 +1,999 @@
1
- import * as Namespace from "./functional/Namespace";
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
- halt("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 occured. 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
- 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 occured. 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
- function decode<T>(input: Uint8Array): Resolved<T>;
129
-
130
- /**
131
- * @internal
132
- */
133
- function decode(): never {
134
- halt("decode");
135
- }
136
- const decodePure = /** @__PURE__ */ Object.assign<typeof decode, {}>(
137
- decode,
138
- /** @__PURE__ */ Namespace.protobuf.decode("decode"),
139
- );
140
- export { decodePure as decode };
141
-
142
- /**
143
- * > You must configure the generic argument `T`.
144
- *
145
- * Protocol Buffer Decoder wity type assertion, but not safe.
146
- *
147
- * `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
148
- * {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
149
- * a TypeScript instance, and performs type assertion process. If decoded value is
150
- * following the type `T`, it returns the decoded value. Otherwise, it throws
151
- * {@link TypeGuardError} instead.
152
- *
153
- * However, note that, this validation is not always safe. It just performs additional
154
- * type assertion like `number & Minimum<7>` or `string & Format<"uuid">` cases,
155
- * that are represented by [custom tags](https://typia.io/docs/validators/tags).
156
- * Therefore, when using `typia.protobuf.assertDecode<T>()` function, you have to
157
- * ensure the type safety by yourself.
158
- *
159
- * In such type safety reason, I recommend you to use type safe encode functions.
160
- *
161
- * - {@link assertEncode}
162
- * - {@link isEncode}
163
- * - {@link validateEncode}
164
- *
165
- * @template T Expected type of decoded value
166
- * @param input Protobuf Buffer binary data
167
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
168
- * @returns Decoded value
169
- *
170
- * @author Jeongho Nam - https://github.com/samchon
171
- */
172
- function assertDecode(
173
- input: Uint8Array,
174
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
175
- ): never;
176
-
177
- /**
178
- * Protocol Buffer Decoder wity type assertion, but not safe.
179
- *
180
- * `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
181
- * {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
182
- * a TypeScript instance, and performs type assertion process. If decoded value is
183
- * following the type `T`, it returns the decoded value. Otherwise, it throws
184
- * {@link TypeGuardError} instead.
185
- *
186
- * However, note that, this validation is not always safe. It just performs additional
187
- * type assertion like `number & Minimum<7>` or `string & Format<"uuid">` cases,
188
- * that are represented by [custom tags](https://typia.io/docs/validators/tags).
189
- * Therefore, when using `typia.protobuf.assertDecode<T>()` function, you have to
190
- * ensure the type safety by yourself.
191
- *
192
- * In such type safety reason, I recommend you to use type safe encode functions.
193
- *
194
- * - {@link assertEncode}
195
- * - {@link isEncode}
196
- * - {@link validateEncode}
197
- *
198
- * @template T Expected type of decoded value
199
- * @param input Protobuf Buffer binary data
200
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
201
- * @returns Decoded value
202
- *
203
- * @author Jeongho Nam - https://github.com/samchon
204
- */
205
- function assertDecode<T>(
206
- input: Uint8Array,
207
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
208
- ): Resolved<T>;
209
-
210
- /**
211
- * @internal
212
- */
213
- function assertDecode(): never {
214
- halt("assertDecode");
215
- }
216
-
217
- const assertDecodePure = /** @__PURE__ */ Object.assign<
218
- typeof assertDecode,
219
- {},
220
- {}
221
- >(
222
- assertDecode,
223
- /** @__PURE__ */ Namespace.assert("protobuf.assertDecode"),
224
- /** @__PURE__ */ Namespace.protobuf.decode("assertDecode"),
225
- );
226
- export { assertDecodePure as assertDecode };
227
-
228
- /**
229
- * > You must configure the generic argument `T`.
230
- *
231
- * Protocol Buffer Decoder wity type checking, but not safe.
232
- *
233
- * `typia.protobuf.isDecode()` is a combination function of {@link decode} and
234
- * {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
235
- * a TypeScript instance, and performs type checking process. If decoded value is
236
- * following the type `T`, it returns the decoded value. Otherwise, it returns
237
- * `null` value instead.
238
- *
239
- * However, note that, this validation is not always safe. It just performs additional
240
- * type checking like `number & Minimum<7>` or `string & Format<"uuid">` cases,
241
- * that are represented by [custom tags](https://typia.io/docs/validators/tags).
242
- * Therefore, when using `typia.protobuf.isDecode<T>()` function, you have to
243
- * ensure the type safety by yourself.
244
- *
245
- * In such type safety reason, I recommend you to use type safe encode functions.
246
- *
247
- * - {@link assertEncode}
248
- * - {@link isEncode}
249
- * - {@link validateEncode}
250
- *
251
- * @template T Expected type of decoded value
252
- * @param input Protobuf Buffer binary data
253
- * @returns Decoded value
254
- *
255
- * @author Jeongho Nam - https://github.com/samchon
256
- */
257
- function isDecode(input: Uint8Array): never;
258
-
259
- /**
260
- * Protocol Buffer Decoder wity type checking, but not safe.
261
- *
262
- * `typia.protobuf.isDecode()` is a combination function of {@link decode} and
263
- * {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
264
- * a TypeScript instance, and performs type checking process. If decoded value is
265
- * following the type `T`, it returns the decoded value. Otherwise, it returns
266
- * `null` value instead.
267
- *
268
- * However, note that, this validation is not always safe. It just performs additional
269
- * type checking like `number & Minimum<7>` or `string & Format<"uuid">` cases,
270
- * that are represented by [custom tags](https://typia.io/docs/validators/tags).
271
- * Therefore, when using `typia.protobuf.isDecode<T>()` function, you have to
272
- * ensure the type safety by yourself.
273
- *
274
- * In such type safety reason, I recommend you to use type safe encode functions.
275
- *
276
- * - {@link assertEncode}
277
- * - {@link isEncode}
278
- * - {@link validateEncode}
279
- *
280
- * @template T Expected type of decoded value
281
- * @param input Protobuf Buffer binary data
282
- * @returns Decoded value
283
- *
284
- * @author Jeongho Nam - https://github.com/samchon
285
- */
286
- function isDecode<T>(input: Uint8Array): Resolved<T> | null;
287
-
288
- /**
289
- * @internal
290
- */
291
- function isDecode(): never {
292
- halt("isDecode");
293
- }
294
- const isDecodePure = /** @__PURE__ */ Object.assign<typeof isDecode, {}, {}>(
295
- isDecode,
296
- /** @__PURE__ */ Namespace.is(),
297
- /** @__PURE__ */ Namespace.protobuf.decode("isDecode"),
298
- );
299
- export { isDecodePure as isDecode };
300
-
301
- /**
302
- * > You must configure the generic argument `T`.
303
- *
304
- * Protocol Buffer Decoder wity type validation, but not safe.
305
- *
306
- * `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
307
- * {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
308
- * a TypeScript instance, and performs type validation process. If decoded value is
309
- * following the type `T`, it returns the decoded value with
310
- * {@link IValidation.ISuccess} typed instance. Otherwise, it returns
311
- * {@link IValidation.IFailure} value instead with detailed error reasons.
312
- *
313
- * However, note that, this validation is not always safe. It just performs additional
314
- * type validation like `number & Minimum<7>` or `string & Format<"uuid">` cases,
315
- * that are represented by [custom tags](https://typia.io/docs/validators/tags).
316
- * Therefore, when using `typia.protobuf.validateDecode<T>()` function, you have to
317
- * ensure the type safety by yourself.
318
- *
319
- * In such type safety reason, I recommend you to use type safe encode functions.
320
- *
321
- * - {@link assertEncode}
322
- * - {@link isEncode}
323
- * - {@link validateEncode}
324
- *
325
- * @template T Expected type of decoded value
326
- * @param input Protobuf Buffer binary data
327
- * @returns Decoded value
328
- *
329
- * @author Jeongho Nam - https://github.com/samchon
330
- */
331
- function validateDecode(input: Uint8Array): never;
332
-
333
- /**
334
- * Protocol Buffer Decoder wity type validation, but not safe.
335
- *
336
- * `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
337
- * {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
338
- * a TypeScript instance, and performs type validation process. If decoded value is
339
- * following the type `T`, it returns the decoded value with
340
- * {@link IValidation.ISuccess} typed instance. Otherwise, it returns
341
- * {@link IValidation.IFailure} value instead with detailed error reasons.
342
- *
343
- * However, note that, this validation is not always safe. It just performs additional
344
- * type validation like `number & Minimum<7>` or `string & Format<"uuid">` cases,
345
- * that are represented by [custom tags](https://typia.io/docs/validators/tags).
346
- * Therefore, when using `typia.protobuf.validateDecode<T>()` function, you have to
347
- * ensure the type safety by yourself.
348
- *
349
- * In such type safety reason, I recommend you to use type safe encode functions.
350
- *
351
- * - {@link assertEncode}
352
- * - {@link isEncode}
353
- * - {@link validateEncode}
354
- *
355
- * @template T Expected type of decoded value
356
- * @param input Protobuf Buffer binary data
357
- * @returns Decoded value
358
- *
359
- * @author Jeongho Nam - https://github.com/samchon
360
- */
361
- function validateDecode<T>(input: Uint8Array): IValidation<Resolved<T>>;
362
-
363
- /**
364
- * @internal
365
- */
366
- function validateDecode(): never {
367
- halt("validateDecode");
368
- }
369
- const validateDecodePure = /** @__PURE__ */ Object.assign<
370
- typeof validateDecode,
371
- {},
372
- {}
373
- >(
374
- validateDecode,
375
- /** @__PURE__ */ Namespace.validate(),
376
- /** @__PURE__ */ Namespace.protobuf.decode("validateDecode"),
377
- );
378
- export { validateDecodePure as validateDecode };
379
-
380
- /* -----------------------------------------------------------
381
- ENCODE
382
- ----------------------------------------------------------- */
383
- /**
384
- * Protocol Buffer Encoder.
385
- *
386
- * Converts an input value to a binary data of Protocol Buffer format.
387
- *
388
- * For reference, this `typia.protobuf.encode()` does not validate the `input` value.
389
- * It just believes that the `input` value is valid and converts it to a binary data
390
- * directly. Therefore, if you can't ensure the `input` value type, it would better to
391
- * call one of below functions intead.
392
- *
393
- * - {@link assertEncode}
394
- * - {@link isEncode}
395
- * - {@link validateEncode}
396
- *
397
- * By the way, you know what? Expression power of Protocol Buffer is not enough strong
398
- * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
399
- * type that is not compatible with Protocol Buffer, this function would throw
400
- * compilation errors.
401
- *
402
- * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
403
- *
404
- * @template T Type of the value input
405
- * @param input A value to encode
406
- * @returns Encoded binary data
407
- *
408
- * @author Jeongho Nam - https://github.com/samchon
409
- */
410
- function encode<T>(input: T): Uint8Array;
411
-
412
- /**
413
- * @internal
414
- */
415
- function encode(): never {
416
- halt("encode");
417
- }
418
- const encodePure = /** @__PURE__ */ Object.assign<typeof encode, {}>(
419
- encode,
420
- /** @__PURE__ */ Namespace.protobuf.encode("encode"),
421
- );
422
- export { encodePure as encode };
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 intead.
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
- function assertEncode<T>(
457
- input: T,
458
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
459
- ): Uint8Array;
460
-
461
- /**
462
- * Protocol Buffer Encoder with type assertion.
463
- *
464
- * `typia.protobuf.assertEncode()` is a combination function of {@link assert} and
465
- * {@link encode}.
466
- *
467
- * Therefore, it converts an `input` value to a binary data of
468
- * Protocol Buffer, with type assertion. If `input` value is not valid, it throws
469
- * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value,
470
- * Protocol 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 isEncode}
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
482
- * compilation errors.
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
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
489
- * @returns Encoded binary data
490
- *
491
- * @author Jeongho Nam - https://github.com/samchon
492
- */
493
- function assertEncode<T>(
494
- input: unknown,
495
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
496
- ): Uint8Array;
497
-
498
- /**
499
- * @internal
500
- */
501
- function assertEncode(): never {
502
- halt("assertEncode");
503
- }
504
- const assertEncodePure = /** @__PURE__ */ Object.assign<
505
- typeof assertEncode,
506
- {},
507
- {}
508
- >(
509
- assertEncode,
510
- /** @__PURE__ */ Namespace.assert("protobuf.assertEncode"),
511
- /** @__PURE__ */ Namespace.protobuf.encode("assertEncode"),
512
- );
513
- export { assertEncodePure as assertEncode };
514
-
515
- /**
516
- * Protocol Buffer Encoder with type checking.
517
- *
518
- * `typia.protobuf.isEncode()` is a combination function of {@link is} and
519
- * {@link encode}.
520
- *
521
- * Therefore, it converts an `input` value to a binary data of
522
- * Protocol Buffer, with type checking. If `input` value is not valid, it returns
523
- * `null` value. Otherwise, there's no problem on the `input` value, Protocol
524
- * Buffer binary data would be returned.
525
- *
526
- * If you can trust `input` value, or want to perform other type of validation, use
527
- * below functions intead.
528
- *
529
- * - {@link encode}
530
- * - {@link assertEncode}
531
- * - {@link validateEncode}
532
- *
533
- * By the way, you know what? Expression power of Protocol Buffer is not enough strong
534
- * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
535
- * type that is not compatible with Protocol Buffer, this function would throw
536
- * compilation errors.
537
- *
538
- * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
539
- *
540
- * @template T Type of the value input
541
- * @param input A value to encode
542
- * @returns Encoded binary data
543
- *
544
- * @author Jeongho Nam - https://github.com/samchon
545
- */
546
- function isEncode<T>(input: T): Uint8Array | null;
547
-
548
- /**
549
- * Protocol Buffer Encoder with type checking.
550
- *
551
- * `typia.protobuf.isEncode()` is a combination function of {@link is} and
552
- * {@link encode}.
553
- *
554
- * Therefore, it converts an `input` value to a binary data of
555
- * Protocol Buffer, with type checking. If `input` value is not valid, it returns
556
- * `null` value. Otherwise, there's no problem on the `input` value, Protocol
557
- * Buffer binary data would be returned.
558
- *
559
- * If you can trust `input` value, or want to perform other type of validation, use
560
- * below functions intead.
561
- *
562
- * - {@link encode}
563
- * - {@link assertEncode}
564
- * - {@link validateEncode}
565
- *
566
- * By the way, you know what? Expression power of Protocol Buffer is not enough strong
567
- * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
568
- * type that is not compatible with Protocol Buffer, this function would throw
569
- * compilation errors.
570
- *
571
- * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
572
- *
573
- * @template T Type of the value input
574
- * @param input A value to encode
575
- * @returns Encoded binary data
576
- *
577
- * @author Jeongho Nam - https://github.com/samchon
578
- */
579
- function isEncode<T>(input: unknown): Uint8Array | null;
580
-
581
- /**
582
- * @internal
583
- */
584
- function isEncode(): never {
585
- halt("isEncode");
586
- }
587
- const isEncodePure = /** @__PURE__ */ Object.assign<typeof isEncode, {}, {}>(
588
- isEncode,
589
- /** @__PURE__ */ Namespace.is(),
590
- /** @__PURE__ */ Namespace.protobuf.encode("isEncode"),
591
- );
592
- export { isEncodePure as isEncode };
593
-
594
- /**
595
- * Protocol Buffer Encoder with type validation.
596
- *
597
- * `typia.protobuf.validateEncode()` is a combination function of
598
- * {@link validation} and {@link encode}.
599
- *
600
- * Therefore, it converts an `input` value to a binary data of
601
- * Protocol Buffer, with type validation. If `input` value is not valid, it returns
602
- * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
603
- * no problem on the `input` value, Protocol Buffer binary data would be stored in
604
- * `data` property of the output {@link IValidation.ISuccess} instance.
605
- *
606
- * If you can trust `input` value, or want to perform other type of validation, use
607
- * below functions intead.
608
- *
609
- * - {@link encode}
610
- * - {@link assertEncode}
611
- * - {@link isEncode}
612
- *
613
- * By the way, you know what? Expression power of Protocol Buffer is not enough strong
614
- * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
615
- * type that is not compatible with Protocol Buffer, this function would throw
616
- * compilation errors.
617
- *
618
- * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
619
- *
620
- * @template T Type of the value input
621
- * @param input A value to encode
622
- * @returns Encoded binary data
623
- *
624
- * @author Jeongho Nam - https://github.com/samchon
625
- */
626
- function validateEncode<T>(input: T): IValidation<Uint8Array>;
627
-
628
- /**
629
- * Protocol Buffer Encoder with type validation.
630
- *
631
- * `typia.protobuf.validateEncode()` is a combination function of
632
- * {@link validation} and {@link encode}.
633
- *
634
- * Therefore, it converts an `input` value to a binary data of
635
- * Protocol Buffer, with type validation. If `input` value is not valid, it returns
636
- * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
637
- * no problem on the `input` value, Protocol Buffer binary data would be stored in
638
- * `data` property of the output {@link IValidation.ISuccess} instance.
639
- *
640
- * If you can trust `input` value, or want to perform other type of validation, use
641
- * below functions intead.
642
- *
643
- * - {@link encode}
644
- * - {@link assertEncode}
645
- * - {@link isEncode}
646
- *
647
- * By the way, you know what? Expression power of Protocol Buffer is not enough strong
648
- * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
649
- * type that is not compatible with Protocol Buffer, this function would throw
650
- * compilation errors.
651
- *
652
- * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
653
- *
654
- * @template T Type of the value input
655
- * @param input A value to encode
656
- * @returns Encoded binary data
657
- *
658
- * @author Jeongho Nam - https://github.com/samchon
659
- */
660
- function validateEncode<T>(input: unknown): IValidation<Uint8Array>;
661
-
662
- /**
663
- * @internal
664
- */
665
- function validateEncode(): never {
666
- halt("validateEncode");
667
- }
668
- const validateEncodePure = /** @__PURE__ */ Object.assign<
669
- typeof validateEncode,
670
- {},
671
- {}
672
- >(
673
- validateEncode,
674
- /** @__PURE__ */ Namespace.validate(),
675
- /** @__PURE__ */ Namespace.protobuf.encode("validateEncode"),
676
- );
677
- export { validateEncodePure as validateEncode };
678
-
679
- /* -----------------------------------------------------------
680
- FACTORY FUNCTIONS
681
- ----------------------------------------------------------- */
682
- /**
683
- * Creates a reusable {@link decode} function.
684
- *
685
- * @danger You must configure the generic argument `T`
686
- * @returns Nothing until you configure the generic argument `T`
687
- * @throws compile error
688
- *
689
- * @author Jeongho Nam - https://github.com/samchon
690
- */
691
- function createDecode(): never;
692
-
693
- /**
694
- * Creates a reusable {@link decode} function.
695
- *
696
- * @template T Target type
697
- * @returns A reusable `decode` function
698
- *
699
- * @author Jeongho Nam - https://github.com/samchon
700
- */
701
- function createDecode<T>(): (input: Uint8Array) => Resolved<T>;
702
-
703
- /**
704
- * @internal
705
- */
706
- function createDecode<T>(): (input: Uint8Array) => Resolved<T> {
707
- halt("createDecode");
708
- }
709
- const createDecodePure = /** @__PURE__ */ Object.assign<
710
- typeof createDecode,
711
- {}
712
- >(createDecode, /** @__PURE__ */ Namespace.protobuf.decode("createDecode"));
713
- export { createDecodePure as createDecode };
714
-
715
- /**
716
- * Creates a reusable {@link isDecode} function.
717
- *
718
- * @danger You must configure the generic argument `T`
719
- * @returns Nothing until you configure the generic argument `T`
720
- * @throws compile error
721
- *
722
- * @author Jeongho Nam - https://github.com/samchon
723
- */
724
- function createIsDecode(): never;
725
-
726
- /**
727
- * Creates a reusable {@link isDecode} function.
728
- *
729
- * @template T Target type
730
- * @returns A reusable `isDecode` function
731
- *
732
- * @author Jeongho Nam - https://github.com/samchon
733
- */
734
- function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null;
735
-
736
- /**
737
- * @internal
738
- */
739
- function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null {
740
- halt("createIsDecode");
741
- }
742
- const createIsDecodePure = /** @__PURE__ */ Object.assign<
743
- typeof createIsDecode,
744
- {},
745
- {}
746
- >(
747
- createIsDecode,
748
- /** @__PURE__ */ Namespace.is(),
749
- /** @__PURE__ */ Namespace.protobuf.decode("createIsDecode"),
750
- );
751
- export { createIsDecodePure as createIsDecode };
752
-
753
- /**
754
- * Creates a reusable {@link assertDecode} function.
755
- *
756
- * @danger You must configure the generic argument `T`
757
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
758
- * @returns Nothing until you configure the generic argument `T`
759
- * @throws compile error
760
- *
761
- * @author Jeongho Nam - https://github.com/samchon
762
- */
763
- function createAssertDecode(
764
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
765
- ): never;
766
-
767
- /**
768
- * Creates a reusable {@link assertDecode} function.
769
- *
770
- * @template T Target type
771
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
772
- * @returns A reusable `assertDecode` function
773
- *
774
- * @author Jeongho Nam - https://github.com/samchon
775
- */
776
- function createAssertDecode<T>(
777
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
778
- ): (input: Uint8Array) => Resolved<T>;
779
-
780
- /**
781
- * @internal
782
- */
783
- function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T> {
784
- halt("createAssertDecode");
785
- }
786
- const createAssertDecodePure = /** @__PURE__ */ Object.assign<
787
- typeof createAssertDecode,
788
- {},
789
- {}
790
- >(
791
- createAssertDecode,
792
- /** @__PURE__ */ Namespace.assert("protobuf.createAssertDecode"),
793
- /** @__PURE__ */ Namespace.protobuf.decode("createAssertDecode"),
794
- );
795
- export { createAssertDecodePure as createAssertDecode };
796
-
797
- /**
798
- * Creates a reusable {@link validateDecode} function.
799
- *
800
- * @danger You must configure the generic argument `T`
801
- * @returns Nothing until you configure the generic argument `T`
802
- * @throws compile error
803
- *
804
- * @author Jeongho Nam - https://github.com/samchon
805
- */
806
- function createValidateDecode(): never;
807
-
808
- /**
809
- * Creates a reusable {@link validateDecode} function.
810
- *
811
- * @template T Target type
812
- * @returns A reusable `validateDecode` function
813
- *
814
- * @author Jeongho Nam - https://github.com/samchon
815
- */
816
- function createValidateDecode<T>(): (
817
- input: Uint8Array,
818
- ) => IValidation<Resolved<T>>;
819
-
820
- /**
821
- * @internal
822
- */
823
- function createValidateDecode<T>(): (
824
- input: Uint8Array,
825
- ) => IValidation<Resolved<T>> {
826
- halt("createValidateDecode");
827
- }
828
- const createValidateDecodePure = /** @__PURE__ */ Object.assign<
829
- typeof createValidateDecode,
830
- {},
831
- {}
832
- >(
833
- createValidateDecode,
834
- /** @__PURE__ */ Namespace.validate(),
835
- /** @__PURE__ */ Namespace.protobuf.decode("createValidateDecode"),
836
- );
837
- export { createValidateDecodePure as createValidateDecode };
838
-
839
- /**
840
- * Creates a reusable {@link encode} function.
841
- *
842
- * @danger You must configure the generic argument `T`
843
- * @returns Nothing until you configure the generic argument `T`
844
- * @throws compile error
845
- *
846
- * @author Jeongho Nam - https://github.com/samchon
847
- */
848
- function createEncode(): never;
849
-
850
- /**
851
- * Creates a reusable {@link encode} function.
852
- *
853
- * @template T Target type
854
- * @returns A reusable `encode` function
855
- *
856
- * @author Jeongho Nam - https://github.com/samchon
857
- */
858
- function createEncode<T>(): (input: T) => Uint8Array;
859
-
860
- /**
861
- * @internal
862
- */
863
- function createEncode<T>(): (input: T) => Uint8Array {
864
- halt("createEncode");
865
- }
866
- const createEncodePure = /** @__PURE__ */ Object.assign<
867
- typeof createEncode,
868
- {}
869
- >(createEncode, /** @__PURE__ */ Namespace.protobuf.encode("createEncode"));
870
- export { createEncodePure as createEncode };
871
-
872
- /**
873
- * Creates a reusable {@link isEncode} function.
874
- *
875
- * @danger You must configure the generic argument `T`
876
- * @returns Nothing until you configure the generic argument `T`
877
- * @throws compile error
878
- *
879
- * @author Jeongho Nam - https://github.com/samchon
880
- */
881
- function createIsEncode(): never;
882
-
883
- /**
884
- * Creates a reusable {@link isEncode} function.
885
- *
886
- * @template T Target type
887
- * @returns A reusable `isEncode` function
888
- *
889
- * @author Jeongho Nam - https://github.com/samchon
890
- */
891
- function createIsEncode<T>(): (input: T) => Uint8Array | null;
892
-
893
- /**
894
- * @internal
895
- */
896
- function createIsEncode<T>(): (input: T) => Uint8Array | null {
897
- halt("createIsEncode");
898
- }
899
- const createIsEncodePure = /** @__PURE__ */ Object.assign<
900
- typeof createIsEncode,
901
- {},
902
- {}
903
- >(
904
- createIsEncode,
905
- /** @__PURE__ */ Namespace.is(),
906
- /** @__PURE__ */ Namespace.protobuf.encode("createIsEncode"),
907
- );
908
- export { createIsEncodePure as createIsEncode };
909
-
910
- /**
911
- * Creates a reusable {@link assertEncode} function.
912
- *
913
- * @danger You must configure the generic argument `T`
914
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
915
- * @returns Nothing until you configure the generic argument `T`
916
- * @throws compile error
917
- *
918
- * @author Jeongho Nam - https://github.com/samchon
919
- */
920
- function createAssertEncode(
921
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
922
- ): never;
923
-
924
- /**
925
- * Creates a reusable {@link assertEncode} function.
926
- *
927
- * @template T Target type
928
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
929
- * @returns A reusable `assertEncode` function
930
- *
931
- * @author Jeongho Nam - https://github.com/samchon
932
- */
933
- function createAssertEncode<T>(
934
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
935
- ): (input: T) => Uint8Array;
936
-
937
- /**
938
- * @internal
939
- */
940
- function createAssertEncode<T>(): (input: T) => Uint8Array {
941
- halt("createAssertEncode");
942
- }
943
- const createAssertEncodePure = /** @__PURE__ */ Object.assign<
944
- typeof createAssertEncode,
945
- {},
946
- {}
947
- >(
948
- createAssertEncode,
949
- /** @__PURE__ */ Namespace.assert("protobuf.createAssertEncode"),
950
- /** @__PURE__ */ Namespace.protobuf.encode("createAssertEncode"),
951
- );
952
- export { createAssertEncodePure as createAssertEncode };
953
-
954
- /**
955
- * Creates a reusable {@link validateEncode} function.
956
- *
957
- * @danger You must configure the generic argument `T`
958
- * @returns Nothing until you configure the generic argument `T`
959
- * @throws compile error
960
- *
961
- * @author Jeongho Nam - https://github.com/samchon
962
- */
963
- function createValidateEncode(): never;
964
-
965
- /**
966
- * Creates a reusable {@link validateEncode} function.
967
- *
968
- * @template T Target type
969
- * @returns A reusable `validateEncode` function
970
- *
971
- * @author Jeongho Nam - https://github.com/samchon
972
- */
973
- function createValidateEncode<T>(): (input: T) => IValidation<Uint8Array>;
974
-
975
- /**
976
- * @internal
977
- */
978
- function createValidateEncode<T>(): (input: T) => IValidation<Uint8Array> {
979
- halt("createValidateEncode");
980
- }
981
- const createValidateEncodePure = /** @__PURE__ */ Object.assign<
982
- typeof createValidateEncode,
983
- {},
984
- {}
985
- >(
986
- createValidateEncode,
987
- /** @__PURE__ */ Namespace.validate(),
988
- /** @__PURE__ */ Namespace.protobuf.encode("createValidateEncode"),
989
- );
990
- export { createValidateEncodePure as createValidateEncode };
991
-
992
- /**
993
- * @internal
994
- */
995
- function halt(name: string): never {
996
- throw new Error(
997
- `Error on typia.protobuf.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
998
- );
999
- }
1
+ import * as Namespace from "./functional/Namespace";
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
+ halt("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 occured. 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
+ 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 occured. 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
+ function decode<T>(input: Uint8Array): Resolved<T>;
129
+
130
+ /**
131
+ * @internal
132
+ */
133
+ function decode(): never {
134
+ halt("decode");
135
+ }
136
+ const decodePure = /** @__PURE__ */ Object.assign<typeof decode, {}>(
137
+ decode,
138
+ /** @__PURE__ */ Namespace.protobuf.decode("decode"),
139
+ );
140
+ export { decodePure as decode };
141
+
142
+ /**
143
+ * > You must configure the generic argument `T`.
144
+ *
145
+ * Protocol Buffer Decoder wity type assertion, but not safe.
146
+ *
147
+ * `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
148
+ * {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
149
+ * a TypeScript instance, and performs type assertion process. If decoded value is
150
+ * following the type `T`, it returns the decoded value. Otherwise, it throws
151
+ * {@link TypeGuardError} instead.
152
+ *
153
+ * However, note that, this validation is not always safe. It just performs additional
154
+ * type assertion like `number & Minimum<7>` or `string & Format<"uuid">` cases,
155
+ * that are represented by [custom tags](https://typia.io/docs/validators/tags).
156
+ * Therefore, when using `typia.protobuf.assertDecode<T>()` function, you have to
157
+ * ensure the type safety by yourself.
158
+ *
159
+ * In such type safety reason, I recommend you to use type safe encode functions.
160
+ *
161
+ * - {@link assertEncode}
162
+ * - {@link isEncode}
163
+ * - {@link validateEncode}
164
+ *
165
+ * @template T Expected type of decoded value
166
+ * @param input Protobuf Buffer binary data
167
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
168
+ * @returns Decoded value
169
+ *
170
+ * @author Jeongho Nam - https://github.com/samchon
171
+ */
172
+ function assertDecode(
173
+ input: Uint8Array,
174
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
175
+ ): never;
176
+
177
+ /**
178
+ * Protocol Buffer Decoder wity type assertion, but not safe.
179
+ *
180
+ * `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
181
+ * {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
182
+ * a TypeScript instance, and performs type assertion process. If decoded value is
183
+ * following the type `T`, it returns the decoded value. Otherwise, it throws
184
+ * {@link TypeGuardError} instead.
185
+ *
186
+ * However, note that, this validation is not always safe. It just performs additional
187
+ * type assertion like `number & Minimum<7>` or `string & Format<"uuid">` cases,
188
+ * that are represented by [custom tags](https://typia.io/docs/validators/tags).
189
+ * Therefore, when using `typia.protobuf.assertDecode<T>()` function, you have to
190
+ * ensure the type safety by yourself.
191
+ *
192
+ * In such type safety reason, I recommend you to use type safe encode functions.
193
+ *
194
+ * - {@link assertEncode}
195
+ * - {@link isEncode}
196
+ * - {@link validateEncode}
197
+ *
198
+ * @template T Expected type of decoded value
199
+ * @param input Protobuf Buffer binary data
200
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
201
+ * @returns Decoded value
202
+ *
203
+ * @author Jeongho Nam - https://github.com/samchon
204
+ */
205
+ function assertDecode<T>(
206
+ input: Uint8Array,
207
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
208
+ ): Resolved<T>;
209
+
210
+ /**
211
+ * @internal
212
+ */
213
+ function assertDecode(): never {
214
+ halt("assertDecode");
215
+ }
216
+
217
+ const assertDecodePure = /** @__PURE__ */ Object.assign<
218
+ typeof assertDecode,
219
+ {},
220
+ {}
221
+ >(
222
+ assertDecode,
223
+ /** @__PURE__ */ Namespace.assert("protobuf.assertDecode"),
224
+ /** @__PURE__ */ Namespace.protobuf.decode("assertDecode"),
225
+ );
226
+ export { assertDecodePure as assertDecode };
227
+
228
+ /**
229
+ * > You must configure the generic argument `T`.
230
+ *
231
+ * Protocol Buffer Decoder wity type checking, but not safe.
232
+ *
233
+ * `typia.protobuf.isDecode()` is a combination function of {@link decode} and
234
+ * {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
235
+ * a TypeScript instance, and performs type checking process. If decoded value is
236
+ * following the type `T`, it returns the decoded value. Otherwise, it returns
237
+ * `null` value instead.
238
+ *
239
+ * However, note that, this validation is not always safe. It just performs additional
240
+ * type checking like `number & Minimum<7>` or `string & Format<"uuid">` cases,
241
+ * that are represented by [custom tags](https://typia.io/docs/validators/tags).
242
+ * Therefore, when using `typia.protobuf.isDecode<T>()` function, you have to
243
+ * ensure the type safety by yourself.
244
+ *
245
+ * In such type safety reason, I recommend you to use type safe encode functions.
246
+ *
247
+ * - {@link assertEncode}
248
+ * - {@link isEncode}
249
+ * - {@link validateEncode}
250
+ *
251
+ * @template T Expected type of decoded value
252
+ * @param input Protobuf Buffer binary data
253
+ * @returns Decoded value
254
+ *
255
+ * @author Jeongho Nam - https://github.com/samchon
256
+ */
257
+ function isDecode(input: Uint8Array): never;
258
+
259
+ /**
260
+ * Protocol Buffer Decoder wity type checking, but not safe.
261
+ *
262
+ * `typia.protobuf.isDecode()` is a combination function of {@link decode} and
263
+ * {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
264
+ * a TypeScript instance, and performs type checking process. If decoded value is
265
+ * following the type `T`, it returns the decoded value. Otherwise, it returns
266
+ * `null` value instead.
267
+ *
268
+ * However, note that, this validation is not always safe. It just performs additional
269
+ * type checking like `number & Minimum<7>` or `string & Format<"uuid">` cases,
270
+ * that are represented by [custom tags](https://typia.io/docs/validators/tags).
271
+ * Therefore, when using `typia.protobuf.isDecode<T>()` function, you have to
272
+ * ensure the type safety by yourself.
273
+ *
274
+ * In such type safety reason, I recommend you to use type safe encode functions.
275
+ *
276
+ * - {@link assertEncode}
277
+ * - {@link isEncode}
278
+ * - {@link validateEncode}
279
+ *
280
+ * @template T Expected type of decoded value
281
+ * @param input Protobuf Buffer binary data
282
+ * @returns Decoded value
283
+ *
284
+ * @author Jeongho Nam - https://github.com/samchon
285
+ */
286
+ function isDecode<T>(input: Uint8Array): Resolved<T> | null;
287
+
288
+ /**
289
+ * @internal
290
+ */
291
+ function isDecode(): never {
292
+ halt("isDecode");
293
+ }
294
+ const isDecodePure = /** @__PURE__ */ Object.assign<typeof isDecode, {}, {}>(
295
+ isDecode,
296
+ /** @__PURE__ */ Namespace.is(),
297
+ /** @__PURE__ */ Namespace.protobuf.decode("isDecode"),
298
+ );
299
+ export { isDecodePure as isDecode };
300
+
301
+ /**
302
+ * > You must configure the generic argument `T`.
303
+ *
304
+ * Protocol Buffer Decoder wity type validation, but not safe.
305
+ *
306
+ * `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
307
+ * {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
308
+ * a TypeScript instance, and performs type validation process. If decoded value is
309
+ * following the type `T`, it returns the decoded value with
310
+ * {@link IValidation.ISuccess} typed instance. Otherwise, it returns
311
+ * {@link IValidation.IFailure} value instead with detailed error reasons.
312
+ *
313
+ * However, note that, this validation is not always safe. It just performs additional
314
+ * type validation like `number & Minimum<7>` or `string & Format<"uuid">` cases,
315
+ * that are represented by [custom tags](https://typia.io/docs/validators/tags).
316
+ * Therefore, when using `typia.protobuf.validateDecode<T>()` function, you have to
317
+ * ensure the type safety by yourself.
318
+ *
319
+ * In such type safety reason, I recommend you to use type safe encode functions.
320
+ *
321
+ * - {@link assertEncode}
322
+ * - {@link isEncode}
323
+ * - {@link validateEncode}
324
+ *
325
+ * @template T Expected type of decoded value
326
+ * @param input Protobuf Buffer binary data
327
+ * @returns Decoded value
328
+ *
329
+ * @author Jeongho Nam - https://github.com/samchon
330
+ */
331
+ function validateDecode(input: Uint8Array): never;
332
+
333
+ /**
334
+ * Protocol Buffer Decoder wity type validation, but not safe.
335
+ *
336
+ * `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
337
+ * {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
338
+ * a TypeScript instance, and performs type validation process. If decoded value is
339
+ * following the type `T`, it returns the decoded value with
340
+ * {@link IValidation.ISuccess} typed instance. Otherwise, it returns
341
+ * {@link IValidation.IFailure} value instead with detailed error reasons.
342
+ *
343
+ * However, note that, this validation is not always safe. It just performs additional
344
+ * type validation like `number & Minimum<7>` or `string & Format<"uuid">` cases,
345
+ * that are represented by [custom tags](https://typia.io/docs/validators/tags).
346
+ * Therefore, when using `typia.protobuf.validateDecode<T>()` function, you have to
347
+ * ensure the type safety by yourself.
348
+ *
349
+ * In such type safety reason, I recommend you to use type safe encode functions.
350
+ *
351
+ * - {@link assertEncode}
352
+ * - {@link isEncode}
353
+ * - {@link validateEncode}
354
+ *
355
+ * @template T Expected type of decoded value
356
+ * @param input Protobuf Buffer binary data
357
+ * @returns Decoded value
358
+ *
359
+ * @author Jeongho Nam - https://github.com/samchon
360
+ */
361
+ function validateDecode<T>(input: Uint8Array): IValidation<Resolved<T>>;
362
+
363
+ /**
364
+ * @internal
365
+ */
366
+ function validateDecode(): never {
367
+ halt("validateDecode");
368
+ }
369
+ const validateDecodePure = /** @__PURE__ */ Object.assign<
370
+ typeof validateDecode,
371
+ {},
372
+ {}
373
+ >(
374
+ validateDecode,
375
+ /** @__PURE__ */ Namespace.validate(),
376
+ /** @__PURE__ */ Namespace.protobuf.decode("validateDecode"),
377
+ );
378
+ export { validateDecodePure as validateDecode };
379
+
380
+ /* -----------------------------------------------------------
381
+ ENCODE
382
+ ----------------------------------------------------------- */
383
+ /**
384
+ * Protocol Buffer Encoder.
385
+ *
386
+ * Converts an input value to a binary data of Protocol Buffer format.
387
+ *
388
+ * For reference, this `typia.protobuf.encode()` does not validate the `input` value.
389
+ * It just believes that the `input` value is valid and converts it to a binary data
390
+ * directly. Therefore, if you can't ensure the `input` value type, it would better to
391
+ * call one of below functions intead.
392
+ *
393
+ * - {@link assertEncode}
394
+ * - {@link isEncode}
395
+ * - {@link validateEncode}
396
+ *
397
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
398
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
399
+ * type that is not compatible with Protocol Buffer, this function would throw
400
+ * compilation errors.
401
+ *
402
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
403
+ *
404
+ * @template T Type of the value input
405
+ * @param input A value to encode
406
+ * @returns Encoded binary data
407
+ *
408
+ * @author Jeongho Nam - https://github.com/samchon
409
+ */
410
+ function encode<T>(input: T): Uint8Array;
411
+
412
+ /**
413
+ * @internal
414
+ */
415
+ function encode(): never {
416
+ halt("encode");
417
+ }
418
+ const encodePure = /** @__PURE__ */ Object.assign<typeof encode, {}>(
419
+ encode,
420
+ /** @__PURE__ */ Namespace.protobuf.encode("encode"),
421
+ );
422
+ export { encodePure as encode };
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 intead.
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
+ function assertEncode<T>(
457
+ input: T,
458
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
459
+ ): Uint8Array;
460
+
461
+ /**
462
+ * Protocol Buffer Encoder with type assertion.
463
+ *
464
+ * `typia.protobuf.assertEncode()` is a combination function of {@link assert} and
465
+ * {@link encode}.
466
+ *
467
+ * Therefore, it converts an `input` value to a binary data of
468
+ * Protocol Buffer, with type assertion. If `input` value is not valid, it throws
469
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value,
470
+ * Protocol 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 isEncode}
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
482
+ * compilation errors.
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
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
489
+ * @returns Encoded binary data
490
+ *
491
+ * @author Jeongho Nam - https://github.com/samchon
492
+ */
493
+ function assertEncode<T>(
494
+ input: unknown,
495
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
496
+ ): Uint8Array;
497
+
498
+ /**
499
+ * @internal
500
+ */
501
+ function assertEncode(): never {
502
+ halt("assertEncode");
503
+ }
504
+ const assertEncodePure = /** @__PURE__ */ Object.assign<
505
+ typeof assertEncode,
506
+ {},
507
+ {}
508
+ >(
509
+ assertEncode,
510
+ /** @__PURE__ */ Namespace.assert("protobuf.assertEncode"),
511
+ /** @__PURE__ */ Namespace.protobuf.encode("assertEncode"),
512
+ );
513
+ export { assertEncodePure as assertEncode };
514
+
515
+ /**
516
+ * Protocol Buffer Encoder with type checking.
517
+ *
518
+ * `typia.protobuf.isEncode()` is a combination function of {@link is} and
519
+ * {@link encode}.
520
+ *
521
+ * Therefore, it converts an `input` value to a binary data of
522
+ * Protocol Buffer, with type checking. If `input` value is not valid, it returns
523
+ * `null` value. Otherwise, there's no problem on the `input` value, Protocol
524
+ * Buffer binary data would be returned.
525
+ *
526
+ * If you can trust `input` value, or want to perform other type of validation, use
527
+ * below functions intead.
528
+ *
529
+ * - {@link encode}
530
+ * - {@link assertEncode}
531
+ * - {@link validateEncode}
532
+ *
533
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
534
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
535
+ * type that is not compatible with Protocol Buffer, this function would throw
536
+ * compilation errors.
537
+ *
538
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
539
+ *
540
+ * @template T Type of the value input
541
+ * @param input A value to encode
542
+ * @returns Encoded binary data
543
+ *
544
+ * @author Jeongho Nam - https://github.com/samchon
545
+ */
546
+ function isEncode<T>(input: T): Uint8Array | null;
547
+
548
+ /**
549
+ * Protocol Buffer Encoder with type checking.
550
+ *
551
+ * `typia.protobuf.isEncode()` is a combination function of {@link is} and
552
+ * {@link encode}.
553
+ *
554
+ * Therefore, it converts an `input` value to a binary data of
555
+ * Protocol Buffer, with type checking. If `input` value is not valid, it returns
556
+ * `null` value. Otherwise, there's no problem on the `input` value, Protocol
557
+ * Buffer binary data would be returned.
558
+ *
559
+ * If you can trust `input` value, or want to perform other type of validation, use
560
+ * below functions intead.
561
+ *
562
+ * - {@link encode}
563
+ * - {@link assertEncode}
564
+ * - {@link validateEncode}
565
+ *
566
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
567
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
568
+ * type that is not compatible with Protocol Buffer, this function would throw
569
+ * compilation errors.
570
+ *
571
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
572
+ *
573
+ * @template T Type of the value input
574
+ * @param input A value to encode
575
+ * @returns Encoded binary data
576
+ *
577
+ * @author Jeongho Nam - https://github.com/samchon
578
+ */
579
+ function isEncode<T>(input: unknown): Uint8Array | null;
580
+
581
+ /**
582
+ * @internal
583
+ */
584
+ function isEncode(): never {
585
+ halt("isEncode");
586
+ }
587
+ const isEncodePure = /** @__PURE__ */ Object.assign<typeof isEncode, {}, {}>(
588
+ isEncode,
589
+ /** @__PURE__ */ Namespace.is(),
590
+ /** @__PURE__ */ Namespace.protobuf.encode("isEncode"),
591
+ );
592
+ export { isEncodePure as isEncode };
593
+
594
+ /**
595
+ * Protocol Buffer Encoder with type validation.
596
+ *
597
+ * `typia.protobuf.validateEncode()` is a combination function of
598
+ * {@link validation} and {@link encode}.
599
+ *
600
+ * Therefore, it converts an `input` value to a binary data of
601
+ * Protocol Buffer, with type validation. If `input` value is not valid, it returns
602
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
603
+ * no problem on the `input` value, Protocol Buffer binary data would be stored in
604
+ * `data` property of the output {@link IValidation.ISuccess} instance.
605
+ *
606
+ * If you can trust `input` value, or want to perform other type of validation, use
607
+ * below functions intead.
608
+ *
609
+ * - {@link encode}
610
+ * - {@link assertEncode}
611
+ * - {@link isEncode}
612
+ *
613
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
614
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
615
+ * type that is not compatible with Protocol Buffer, this function would throw
616
+ * compilation errors.
617
+ *
618
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
619
+ *
620
+ * @template T Type of the value input
621
+ * @param input A value to encode
622
+ * @returns Encoded binary data
623
+ *
624
+ * @author Jeongho Nam - https://github.com/samchon
625
+ */
626
+ function validateEncode<T>(input: T): IValidation<Uint8Array>;
627
+
628
+ /**
629
+ * Protocol Buffer Encoder with type validation.
630
+ *
631
+ * `typia.protobuf.validateEncode()` is a combination function of
632
+ * {@link validation} and {@link encode}.
633
+ *
634
+ * Therefore, it converts an `input` value to a binary data of
635
+ * Protocol Buffer, with type validation. If `input` value is not valid, it returns
636
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
637
+ * no problem on the `input` value, Protocol Buffer binary data would be stored in
638
+ * `data` property of the output {@link IValidation.ISuccess} instance.
639
+ *
640
+ * If you can trust `input` value, or want to perform other type of validation, use
641
+ * below functions intead.
642
+ *
643
+ * - {@link encode}
644
+ * - {@link assertEncode}
645
+ * - {@link isEncode}
646
+ *
647
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
648
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
649
+ * type that is not compatible with Protocol Buffer, this function would throw
650
+ * compilation errors.
651
+ *
652
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
653
+ *
654
+ * @template T Type of the value input
655
+ * @param input A value to encode
656
+ * @returns Encoded binary data
657
+ *
658
+ * @author Jeongho Nam - https://github.com/samchon
659
+ */
660
+ function validateEncode<T>(input: unknown): IValidation<Uint8Array>;
661
+
662
+ /**
663
+ * @internal
664
+ */
665
+ function validateEncode(): never {
666
+ halt("validateEncode");
667
+ }
668
+ const validateEncodePure = /** @__PURE__ */ Object.assign<
669
+ typeof validateEncode,
670
+ {},
671
+ {}
672
+ >(
673
+ validateEncode,
674
+ /** @__PURE__ */ Namespace.validate(),
675
+ /** @__PURE__ */ Namespace.protobuf.encode("validateEncode"),
676
+ );
677
+ export { validateEncodePure as validateEncode };
678
+
679
+ /* -----------------------------------------------------------
680
+ FACTORY FUNCTIONS
681
+ ----------------------------------------------------------- */
682
+ /**
683
+ * Creates a reusable {@link decode} function.
684
+ *
685
+ * @danger You must configure the generic argument `T`
686
+ * @returns Nothing until you configure the generic argument `T`
687
+ * @throws compile error
688
+ *
689
+ * @author Jeongho Nam - https://github.com/samchon
690
+ */
691
+ function createDecode(): never;
692
+
693
+ /**
694
+ * Creates a reusable {@link decode} function.
695
+ *
696
+ * @template T Target type
697
+ * @returns A reusable `decode` function
698
+ *
699
+ * @author Jeongho Nam - https://github.com/samchon
700
+ */
701
+ function createDecode<T>(): (input: Uint8Array) => Resolved<T>;
702
+
703
+ /**
704
+ * @internal
705
+ */
706
+ function createDecode<T>(): (input: Uint8Array) => Resolved<T> {
707
+ halt("createDecode");
708
+ }
709
+ const createDecodePure = /** @__PURE__ */ Object.assign<
710
+ typeof createDecode,
711
+ {}
712
+ >(createDecode, /** @__PURE__ */ Namespace.protobuf.decode("createDecode"));
713
+ export { createDecodePure as createDecode };
714
+
715
+ /**
716
+ * Creates a reusable {@link isDecode} function.
717
+ *
718
+ * @danger You must configure the generic argument `T`
719
+ * @returns Nothing until you configure the generic argument `T`
720
+ * @throws compile error
721
+ *
722
+ * @author Jeongho Nam - https://github.com/samchon
723
+ */
724
+ function createIsDecode(): never;
725
+
726
+ /**
727
+ * Creates a reusable {@link isDecode} function.
728
+ *
729
+ * @template T Target type
730
+ * @returns A reusable `isDecode` function
731
+ *
732
+ * @author Jeongho Nam - https://github.com/samchon
733
+ */
734
+ function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null;
735
+
736
+ /**
737
+ * @internal
738
+ */
739
+ function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null {
740
+ halt("createIsDecode");
741
+ }
742
+ const createIsDecodePure = /** @__PURE__ */ Object.assign<
743
+ typeof createIsDecode,
744
+ {},
745
+ {}
746
+ >(
747
+ createIsDecode,
748
+ /** @__PURE__ */ Namespace.is(),
749
+ /** @__PURE__ */ Namespace.protobuf.decode("createIsDecode"),
750
+ );
751
+ export { createIsDecodePure as createIsDecode };
752
+
753
+ /**
754
+ * Creates a reusable {@link assertDecode} function.
755
+ *
756
+ * @danger You must configure the generic argument `T`
757
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
758
+ * @returns Nothing until you configure the generic argument `T`
759
+ * @throws compile error
760
+ *
761
+ * @author Jeongho Nam - https://github.com/samchon
762
+ */
763
+ function createAssertDecode(
764
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
765
+ ): never;
766
+
767
+ /**
768
+ * Creates a reusable {@link assertDecode} function.
769
+ *
770
+ * @template T Target type
771
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
772
+ * @returns A reusable `assertDecode` function
773
+ *
774
+ * @author Jeongho Nam - https://github.com/samchon
775
+ */
776
+ function createAssertDecode<T>(
777
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
778
+ ): (input: Uint8Array) => Resolved<T>;
779
+
780
+ /**
781
+ * @internal
782
+ */
783
+ function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T> {
784
+ halt("createAssertDecode");
785
+ }
786
+ const createAssertDecodePure = /** @__PURE__ */ Object.assign<
787
+ typeof createAssertDecode,
788
+ {},
789
+ {}
790
+ >(
791
+ createAssertDecode,
792
+ /** @__PURE__ */ Namespace.assert("protobuf.createAssertDecode"),
793
+ /** @__PURE__ */ Namespace.protobuf.decode("createAssertDecode"),
794
+ );
795
+ export { createAssertDecodePure as createAssertDecode };
796
+
797
+ /**
798
+ * Creates a reusable {@link validateDecode} function.
799
+ *
800
+ * @danger You must configure the generic argument `T`
801
+ * @returns Nothing until you configure the generic argument `T`
802
+ * @throws compile error
803
+ *
804
+ * @author Jeongho Nam - https://github.com/samchon
805
+ */
806
+ function createValidateDecode(): never;
807
+
808
+ /**
809
+ * Creates a reusable {@link validateDecode} function.
810
+ *
811
+ * @template T Target type
812
+ * @returns A reusable `validateDecode` function
813
+ *
814
+ * @author Jeongho Nam - https://github.com/samchon
815
+ */
816
+ function createValidateDecode<T>(): (
817
+ input: Uint8Array,
818
+ ) => IValidation<Resolved<T>>;
819
+
820
+ /**
821
+ * @internal
822
+ */
823
+ function createValidateDecode<T>(): (
824
+ input: Uint8Array,
825
+ ) => IValidation<Resolved<T>> {
826
+ halt("createValidateDecode");
827
+ }
828
+ const createValidateDecodePure = /** @__PURE__ */ Object.assign<
829
+ typeof createValidateDecode,
830
+ {},
831
+ {}
832
+ >(
833
+ createValidateDecode,
834
+ /** @__PURE__ */ Namespace.validate(),
835
+ /** @__PURE__ */ Namespace.protobuf.decode("createValidateDecode"),
836
+ );
837
+ export { createValidateDecodePure as createValidateDecode };
838
+
839
+ /**
840
+ * Creates a reusable {@link encode} function.
841
+ *
842
+ * @danger You must configure the generic argument `T`
843
+ * @returns Nothing until you configure the generic argument `T`
844
+ * @throws compile error
845
+ *
846
+ * @author Jeongho Nam - https://github.com/samchon
847
+ */
848
+ function createEncode(): never;
849
+
850
+ /**
851
+ * Creates a reusable {@link encode} function.
852
+ *
853
+ * @template T Target type
854
+ * @returns A reusable `encode` function
855
+ *
856
+ * @author Jeongho Nam - https://github.com/samchon
857
+ */
858
+ function createEncode<T>(): (input: T) => Uint8Array;
859
+
860
+ /**
861
+ * @internal
862
+ */
863
+ function createEncode<T>(): (input: T) => Uint8Array {
864
+ halt("createEncode");
865
+ }
866
+ const createEncodePure = /** @__PURE__ */ Object.assign<
867
+ typeof createEncode,
868
+ {}
869
+ >(createEncode, /** @__PURE__ */ Namespace.protobuf.encode("createEncode"));
870
+ export { createEncodePure as createEncode };
871
+
872
+ /**
873
+ * Creates a reusable {@link isEncode} function.
874
+ *
875
+ * @danger You must configure the generic argument `T`
876
+ * @returns Nothing until you configure the generic argument `T`
877
+ * @throws compile error
878
+ *
879
+ * @author Jeongho Nam - https://github.com/samchon
880
+ */
881
+ function createIsEncode(): never;
882
+
883
+ /**
884
+ * Creates a reusable {@link isEncode} function.
885
+ *
886
+ * @template T Target type
887
+ * @returns A reusable `isEncode` function
888
+ *
889
+ * @author Jeongho Nam - https://github.com/samchon
890
+ */
891
+ function createIsEncode<T>(): (input: T) => Uint8Array | null;
892
+
893
+ /**
894
+ * @internal
895
+ */
896
+ function createIsEncode<T>(): (input: T) => Uint8Array | null {
897
+ halt("createIsEncode");
898
+ }
899
+ const createIsEncodePure = /** @__PURE__ */ Object.assign<
900
+ typeof createIsEncode,
901
+ {},
902
+ {}
903
+ >(
904
+ createIsEncode,
905
+ /** @__PURE__ */ Namespace.is(),
906
+ /** @__PURE__ */ Namespace.protobuf.encode("createIsEncode"),
907
+ );
908
+ export { createIsEncodePure as createIsEncode };
909
+
910
+ /**
911
+ * Creates a reusable {@link assertEncode} function.
912
+ *
913
+ * @danger You must configure the generic argument `T`
914
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
915
+ * @returns Nothing until you configure the generic argument `T`
916
+ * @throws compile error
917
+ *
918
+ * @author Jeongho Nam - https://github.com/samchon
919
+ */
920
+ function createAssertEncode(
921
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
922
+ ): never;
923
+
924
+ /**
925
+ * Creates a reusable {@link assertEncode} function.
926
+ *
927
+ * @template T Target type
928
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
929
+ * @returns A reusable `assertEncode` function
930
+ *
931
+ * @author Jeongho Nam - https://github.com/samchon
932
+ */
933
+ function createAssertEncode<T>(
934
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
935
+ ): (input: T) => Uint8Array;
936
+
937
+ /**
938
+ * @internal
939
+ */
940
+ function createAssertEncode<T>(): (input: T) => Uint8Array {
941
+ halt("createAssertEncode");
942
+ }
943
+ const createAssertEncodePure = /** @__PURE__ */ Object.assign<
944
+ typeof createAssertEncode,
945
+ {},
946
+ {}
947
+ >(
948
+ createAssertEncode,
949
+ /** @__PURE__ */ Namespace.assert("protobuf.createAssertEncode"),
950
+ /** @__PURE__ */ Namespace.protobuf.encode("createAssertEncode"),
951
+ );
952
+ export { createAssertEncodePure as createAssertEncode };
953
+
954
+ /**
955
+ * Creates a reusable {@link validateEncode} function.
956
+ *
957
+ * @danger You must configure the generic argument `T`
958
+ * @returns Nothing until you configure the generic argument `T`
959
+ * @throws compile error
960
+ *
961
+ * @author Jeongho Nam - https://github.com/samchon
962
+ */
963
+ function createValidateEncode(): never;
964
+
965
+ /**
966
+ * Creates a reusable {@link validateEncode} function.
967
+ *
968
+ * @template T Target type
969
+ * @returns A reusable `validateEncode` function
970
+ *
971
+ * @author Jeongho Nam - https://github.com/samchon
972
+ */
973
+ function createValidateEncode<T>(): (input: T) => IValidation<Uint8Array>;
974
+
975
+ /**
976
+ * @internal
977
+ */
978
+ function createValidateEncode<T>(): (input: T) => IValidation<Uint8Array> {
979
+ halt("createValidateEncode");
980
+ }
981
+ const createValidateEncodePure = /** @__PURE__ */ Object.assign<
982
+ typeof createValidateEncode,
983
+ {},
984
+ {}
985
+ >(
986
+ createValidateEncode,
987
+ /** @__PURE__ */ Namespace.validate(),
988
+ /** @__PURE__ */ Namespace.protobuf.encode("createValidateEncode"),
989
+ );
990
+ export { createValidateEncodePure as createValidateEncode };
991
+
992
+ /**
993
+ * @internal
994
+ */
995
+ function halt(name: string): never {
996
+ throw new Error(
997
+ `Error on typia.protobuf.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
998
+ );
999
+ }