typia 7.0.0-dev.20241003 → 7.0.0-dev.20241007

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