typia 5.5.8 → 5.5.9

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 (358) hide show
  1. package/lib/tags/ContentMediaType.d.ts +9 -0
  2. package/lib/tags/ContentMediaType.js +3 -0
  3. package/lib/tags/ContentMediaType.js.map +1 -0
  4. package/lib/tags/JsonSchemaPlugin.d.ts +7 -0
  5. package/lib/tags/JsonSchemaPlugin.js +3 -0
  6. package/lib/tags/JsonSchemaPlugin.js.map +1 -0
  7. package/lib/tags/index.d.ts +2 -0
  8. package/lib/tags/index.js +2 -0
  9. package/lib/tags/index.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/AssertionGuard.ts +1 -1
  12. package/src/IRandomGenerator.ts +62 -62
  13. package/src/IValidation.ts +21 -21
  14. package/src/TypeGuardError.ts +36 -36
  15. package/src/executable/TypiaGenerateWizard.ts +83 -83
  16. package/src/executable/TypiaPatchWizard.ts +42 -42
  17. package/src/executable/setup/ArgumentParser.ts +43 -43
  18. package/src/executable/setup/CommandExecutor.ts +8 -8
  19. package/src/executable/setup/FileRetriever.ts +22 -22
  20. package/src/executable/setup/PackageManager.ts +71 -71
  21. package/src/executable/setup/PluginConfigurator.ts +69 -69
  22. package/src/executable/typia.ts +55 -55
  23. package/src/factories/CommentFactory.ts +79 -79
  24. package/src/factories/ExpressionFactory.ts +150 -150
  25. package/src/factories/IdentifierFactory.ts +70 -70
  26. package/src/factories/JsonMetadataFactory.ts +53 -53
  27. package/src/factories/LiteralFactory.ts +47 -47
  28. package/src/factories/MetadataCollection.ts +260 -260
  29. package/src/factories/MetadataCommentTagFactory.ts +516 -516
  30. package/src/factories/MetadataFactory.ts +267 -267
  31. package/src/factories/MetadataTypeTagFactory.ts +332 -332
  32. package/src/factories/MetadataTypeTagSchemaFactory.ts +58 -58
  33. package/src/factories/NumericRangeFactory.ts +72 -72
  34. package/src/factories/ProtobufFactory.ts +267 -267
  35. package/src/factories/StatementFactory.ts +72 -72
  36. package/src/factories/TemplateFactory.ts +56 -56
  37. package/src/factories/ValueFactory.ts +12 -12
  38. package/src/factories/internal/metadata/MetadataHelper.ts +15 -15
  39. package/src/factories/internal/metadata/emend_metadata_atomics.ts +46 -46
  40. package/src/factories/internal/metadata/emplace_metadata_alias.ts +41 -41
  41. package/src/factories/internal/metadata/emplace_metadata_array_type.ts +38 -38
  42. package/src/factories/internal/metadata/emplace_metadata_object.ts +176 -176
  43. package/src/factories/internal/metadata/emplace_metadata_tuple.ts +57 -57
  44. package/src/factories/internal/metadata/explore_metadata.ts +28 -28
  45. package/src/factories/internal/metadata/iterate_metadata_alias.ts +34 -34
  46. package/src/factories/internal/metadata/iterate_metadata_array.ts +70 -70
  47. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
  48. package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
  49. package/src/factories/internal/metadata/iterate_metadata_collection.ts +131 -131
  50. package/src/factories/internal/metadata/iterate_metadata_comment_tags.ts +26 -26
  51. package/src/factories/internal/metadata/iterate_metadata_constant.ts +48 -48
  52. package/src/factories/internal/metadata/iterate_metadata_escape.ts +52 -52
  53. package/src/factories/internal/metadata/iterate_metadata_map.ts +50 -50
  54. package/src/factories/internal/metadata/iterate_metadata_native.ts +209 -209
  55. package/src/factories/internal/metadata/iterate_metadata_object.ts +33 -33
  56. package/src/factories/internal/metadata/iterate_metadata_set.ts +41 -41
  57. package/src/factories/internal/metadata/iterate_metadata_template.ts +44 -44
  58. package/src/factories/internal/metadata/iterate_metadata_tuple.ts +37 -37
  59. package/src/factories/internal/metadata/iterate_metadata_union.ts +27 -27
  60. package/src/functional/$FormDataReader/index.ts +1 -1
  61. package/src/functional/$HeadersReader/index.ts +1 -1
  62. package/src/functional/$ParameterReader/index.ts +1 -1
  63. package/src/functional/$ProtobufReader.ts +195 -195
  64. package/src/functional/$ProtobufWriter.ts +150 -150
  65. package/src/functional/$QueryReader/index.ts +1 -1
  66. package/src/functional/$any.ts +4 -4
  67. package/src/functional/$clone.ts +4 -4
  68. package/src/functional/$convention.ts +37 -37
  69. package/src/functional/$dictionary.ts +22 -22
  70. package/src/functional/$every.ts +11 -11
  71. package/src/functional/$guard.ts +21 -21
  72. package/src/functional/$is_between.ts +2 -2
  73. package/src/functional/$join.ts +46 -46
  74. package/src/functional/$number.ts +12 -12
  75. package/src/functional/$report.ts +13 -13
  76. package/src/functional/$rest.ts +3 -3
  77. package/src/functional/$stoll.ts +8 -8
  78. package/src/functional/$string.ts +43 -43
  79. package/src/functional/$strlen.ts +7 -7
  80. package/src/functional/$tail.ts +5 -5
  81. package/src/functional/$throws.ts +10 -10
  82. package/src/functional/$varint.ts +130 -130
  83. package/src/functional/$zigzag.ts +39 -39
  84. package/src/functional/IProtobufWriter.ts +18 -18
  85. package/src/functional/Namespace/functional.ts +5 -5
  86. package/src/functional/Namespace/http.ts +9 -9
  87. package/src/functional/Namespace/index.ts +76 -76
  88. package/src/functional/Namespace/json.ts +15 -15
  89. package/src/functional/Namespace/misc.ts +14 -14
  90. package/src/functional/Namespace/notations.ts +23 -23
  91. package/src/functional/Namespace/protobuf.ts +20 -20
  92. package/src/functional/is.ts +10 -10
  93. package/src/functional.ts +872 -872
  94. package/src/http.ts +1266 -1266
  95. package/src/index.ts +4 -4
  96. package/src/json.ts +754 -754
  97. package/src/misc.ts +757 -757
  98. package/src/module.ts +1024 -1024
  99. package/src/notations.ts +1020 -1020
  100. package/src/programmers/functional/FunctionalAssertFunctionProgrammer.ts +130 -130
  101. package/src/programmers/functional/FunctionalAssertParametersProgrammer.ts +81 -81
  102. package/src/programmers/functional/FunctionalAssertReturnProgrammer.ts +77 -77
  103. package/src/programmers/functional/FunctionalIsFunctionProgrammer.ts +61 -61
  104. package/src/programmers/functional/FunctionalValidateFunctionProgrammer.ts +113 -113
  105. package/src/programmers/functional/FunctionalValidateParametersProgrammer.ts +203 -203
  106. package/src/programmers/functional/FunctionalValidateReturnProgrammer.ts +107 -107
  107. package/src/programmers/functional/internal/FunctionalGeneralProgrammer.ts +32 -32
  108. package/src/programmers/helpers/AtomicPredicator.ts +24 -24
  109. package/src/programmers/helpers/CloneJoiner.ts +130 -130
  110. package/src/programmers/helpers/FunctionImporeter.ts +1 -1
  111. package/src/programmers/helpers/FunctionImporter.ts +87 -87
  112. package/src/programmers/helpers/HttpMetadataUtil.ts +21 -21
  113. package/src/programmers/helpers/ICheckEntry.ts +13 -13
  114. package/src/programmers/helpers/IExpressionEntry.ts +12 -12
  115. package/src/programmers/helpers/NotationJoiner.ts +132 -132
  116. package/src/programmers/helpers/OptionPredicator.ts +15 -15
  117. package/src/programmers/helpers/ProtobufUtil.ts +125 -125
  118. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  119. package/src/programmers/helpers/PruneJoiner.ts +141 -141
  120. package/src/programmers/helpers/RandomJoiner.ts +140 -140
  121. package/src/programmers/helpers/RandomRanger.ts +171 -171
  122. package/src/programmers/helpers/StringifyJoinder.ts +105 -105
  123. package/src/programmers/helpers/StringifyPredicator.ts +12 -12
  124. package/src/programmers/helpers/UnionExplorer.ts +269 -269
  125. package/src/programmers/helpers/UnionPredicator.ts +77 -77
  126. package/src/programmers/http/HttpAssertFormDataProgrammer.ts +87 -87
  127. package/src/programmers/http/HttpAssertHeadersProgrammer.ts +89 -89
  128. package/src/programmers/http/HttpAssertQueryProgrammer.ts +87 -87
  129. package/src/programmers/http/HttpIsFormDataProgrammer.ts +90 -90
  130. package/src/programmers/http/HttpIsHeadersProgrammer.ts +92 -92
  131. package/src/programmers/http/HttpIsQueryProgrammer.ts +90 -90
  132. package/src/programmers/http/HttpParameterProgrammer.ts +97 -97
  133. package/src/programmers/http/HttpValidateFormDataProgrammer.ts +75 -75
  134. package/src/programmers/http/HttpValidateHeadersProgrammer.ts +77 -77
  135. package/src/programmers/http/HttpValidateQueryProgrammer.ts +75 -75
  136. package/src/programmers/internal/JSON_SCHEMA_PREFIX.ts +1 -1
  137. package/src/programmers/internal/application_alias.ts +74 -74
  138. package/src/programmers/internal/application_array.ts +63 -63
  139. package/src/programmers/internal/application_boolean.ts +44 -44
  140. package/src/programmers/internal/application_default.ts +17 -17
  141. package/src/programmers/internal/application_default_string.ts +33 -33
  142. package/src/programmers/internal/application_native.ts +40 -40
  143. package/src/programmers/internal/application_number.ts +98 -98
  144. package/src/programmers/internal/application_schema.ts +165 -165
  145. package/src/programmers/internal/application_string.ts +65 -65
  146. package/src/programmers/internal/application_templates.ts +24 -24
  147. package/src/programmers/internal/application_tuple.ts +54 -54
  148. package/src/programmers/internal/check_array_length.ts +45 -45
  149. package/src/programmers/internal/check_bigint.ts +49 -49
  150. package/src/programmers/internal/check_dynamic_properties.ts +211 -211
  151. package/src/programmers/internal/check_everything.ts +23 -23
  152. package/src/programmers/internal/check_native.ts +21 -21
  153. package/src/programmers/internal/check_string.ts +48 -48
  154. package/src/programmers/internal/check_template.ts +61 -61
  155. package/src/programmers/internal/check_union_array_like.ts +307 -307
  156. package/src/programmers/internal/decode_union_object.ts +99 -99
  157. package/src/programmers/internal/metadata_to_pattern.ts +33 -33
  158. package/src/programmers/internal/prune_object_properties.ts +60 -60
  159. package/src/programmers/internal/random_custom.ts +37 -37
  160. package/src/programmers/internal/stringify_dynamic_properties.ts +157 -157
  161. package/src/programmers/internal/stringify_native.ts +7 -7
  162. package/src/programmers/internal/stringify_regular_properties.ts +81 -81
  163. package/src/programmers/internal/template_to_pattern.ts +15 -15
  164. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +20 -20
  165. package/src/programmers/json/JsonAssertParseProgrammer.ts +81 -81
  166. package/src/programmers/json/JsonAssertStringifyProgrammer.ts +67 -67
  167. package/src/programmers/json/JsonIsParseProgrammer.ts +81 -81
  168. package/src/programmers/json/JsonIsStringifyProgrammer.ts +75 -75
  169. package/src/programmers/json/JsonValidateParseProgrammer.ts +64 -64
  170. package/src/programmers/json/JsonValidateStringifyProgrammer.ts +83 -83
  171. package/src/programmers/misc/MiscAssertCloneProgrammer.ts +77 -77
  172. package/src/programmers/misc/MiscAssertPruneProgrammer.ts +66 -66
  173. package/src/programmers/misc/MiscIsCloneProgrammer.ts +78 -78
  174. package/src/programmers/misc/MiscIsPruneProgrammer.ts +66 -66
  175. package/src/programmers/misc/MiscPruneProgrammer.ts +523 -523
  176. package/src/programmers/misc/MiscValidateCloneProgrammer.ts +80 -80
  177. package/src/programmers/misc/MiscValidatePruneProgrammer.ts +73 -73
  178. package/src/programmers/notations/NotationAssertGeneralProgrammer.ts +70 -70
  179. package/src/programmers/notations/NotationGeneralProgrammer.ts +647 -647
  180. package/src/programmers/notations/NotationIsGeneralProgrammer.ts +71 -71
  181. package/src/programmers/notations/NotationValidateGeneralProgrammer.ts +81 -81
  182. package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +87 -87
  183. package/src/programmers/protobuf/ProtobufAssertEncodeProgrammer.ts +67 -67
  184. package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +90 -90
  185. package/src/programmers/protobuf/ProtobufIsEncodeProgrammer.ts +75 -75
  186. package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +75 -75
  187. package/src/programmers/protobuf/ProtobufValidateEncodeProgrammer.ts +83 -83
  188. package/src/protobuf.ts +999 -999
  189. package/src/reflect.ts +57 -57
  190. package/src/schemas/json/IJsonApplication.ts +9 -9
  191. package/src/schemas/json/IJsonComponents.ts +19 -19
  192. package/src/schemas/json/IJsonSchema.ts +147 -147
  193. package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
  194. package/src/schemas/metadata/IMetadata.ts +34 -34
  195. package/src/schemas/metadata/IMetadataAlias.ts +12 -12
  196. package/src/schemas/metadata/IMetadataApplication.ts +7 -7
  197. package/src/schemas/metadata/IMetadataArray.ts +7 -7
  198. package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
  199. package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
  200. package/src/schemas/metadata/IMetadataComponents.ts +11 -11
  201. package/src/schemas/metadata/IMetadataConstant.ts +23 -23
  202. package/src/schemas/metadata/IMetadataDictionary.ts +11 -11
  203. package/src/schemas/metadata/IMetadataEntry.ts +6 -6
  204. package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
  205. package/src/schemas/metadata/IMetadataObject.ts +13 -13
  206. package/src/schemas/metadata/IMetadataProperty.ts +9 -9
  207. package/src/schemas/metadata/IMetadataTuple.ts +7 -7
  208. package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
  209. package/src/schemas/metadata/IMetadataTypeTag.ts +16 -16
  210. package/src/schemas/metadata/Metadata.ts +631 -631
  211. package/src/schemas/metadata/MetadataAlias.ts +61 -61
  212. package/src/schemas/metadata/MetadataApplication.ts +44 -44
  213. package/src/schemas/metadata/MetadataArray.ts +49 -49
  214. package/src/schemas/metadata/MetadataArrayType.ts +57 -57
  215. package/src/schemas/metadata/MetadataAtomic.ts +85 -85
  216. package/src/schemas/metadata/MetadataComponents.ts +98 -98
  217. package/src/schemas/metadata/MetadataConstant.ts +46 -46
  218. package/src/schemas/metadata/MetadataEscaped.ts +51 -51
  219. package/src/schemas/metadata/MetadataObject.ts +154 -154
  220. package/src/schemas/metadata/MetadataProperty.ts +56 -56
  221. package/src/schemas/metadata/MetadataTuple.ts +32 -32
  222. package/src/schemas/metadata/MetadataTupleType.ts +67 -67
  223. package/src/tags/ContentMediaType.ts +10 -0
  224. package/src/tags/Default.ts +18 -18
  225. package/src/tags/ExclusiveMaximum.ts +19 -19
  226. package/src/tags/ExclusiveMinimum.ts +19 -19
  227. package/src/tags/Format.ts +16 -16
  228. package/src/tags/JsonSchemaPlugin.ts +8 -0
  229. package/src/tags/MaxItems.ts +12 -12
  230. package/src/tags/MaxLength.ts +12 -12
  231. package/src/tags/Maximum.ts +18 -18
  232. package/src/tags/MinItems.ts +12 -12
  233. package/src/tags/MinLength.ts +12 -12
  234. package/src/tags/Minimum.ts +18 -18
  235. package/src/tags/MultipleOf.ts +20 -20
  236. package/src/tags/Pattern.ts +12 -12
  237. package/src/tags/TagBase.ts +76 -76
  238. package/src/tags/index.ts +16 -14
  239. package/src/tags/internal/FormatCheatSheet.ts +71 -71
  240. package/src/transform.ts +35 -35
  241. package/src/transformers/CallExpressionTransformer.ts +496 -496
  242. package/src/transformers/FileTransformer.ts +91 -91
  243. package/src/transformers/IProject.ts +15 -15
  244. package/src/transformers/ITransformOptions.ts +62 -62
  245. package/src/transformers/ImportTransformer.ts +66 -66
  246. package/src/transformers/NodeTransformer.ts +13 -13
  247. package/src/transformers/TransformerError.ts +55 -55
  248. package/src/transformers/features/CreateIsTransformer.ts +10 -10
  249. package/src/transformers/features/CreateRandomTransformer.ts +40 -40
  250. package/src/transformers/features/CreateValidateTransformer.ts +13 -13
  251. package/src/transformers/features/IsTransformer.ts +10 -10
  252. package/src/transformers/features/RandomTransformer.ts +44 -44
  253. package/src/transformers/features/ValidateTransformer.ts +11 -11
  254. package/src/transformers/features/http/CreateHttpAssertFormDataTransformer.ts +12 -12
  255. package/src/transformers/features/http/CreateHttpAssertHeadersTransformer.ts +11 -11
  256. package/src/transformers/features/http/CreateHttpAssertQueryTransformer.ts +9 -9
  257. package/src/transformers/features/http/CreateHttpFormDataTransformer.ts +9 -9
  258. package/src/transformers/features/http/CreateHttpHeadersTransformer.ts +9 -9
  259. package/src/transformers/features/http/CreateHttpIsFormDataTransformer.ts +9 -9
  260. package/src/transformers/features/http/CreateHttpIsHeadersTransformer.ts +9 -9
  261. package/src/transformers/features/http/CreateHttpIsQueryTransformer.ts +9 -9
  262. package/src/transformers/features/http/CreateHttpParameterTransformer.ts +9 -9
  263. package/src/transformers/features/http/CreateHttpQueryTransformer.ts +9 -9
  264. package/src/transformers/features/http/CreateHttpValidateFormDataTransformer.ts +12 -12
  265. package/src/transformers/features/http/CreateHttpValidateHeadersTransformer.ts +12 -12
  266. package/src/transformers/features/http/CreateHttpValidateQueryTransformer.ts +11 -11
  267. package/src/transformers/features/http/HttpAssertFormDataTransformer.ts +10 -10
  268. package/src/transformers/features/http/HttpAssertHeadersTransformer.ts +9 -9
  269. package/src/transformers/features/http/HttpAssertQueryTransformer.ts +9 -9
  270. package/src/transformers/features/http/HttpFormDataTransformer.ts +9 -9
  271. package/src/transformers/features/http/HttpHeadersTransformer.ts +9 -9
  272. package/src/transformers/features/http/HttpIsFormDataTransformer.ts +9 -9
  273. package/src/transformers/features/http/HttpIsHeadersTransformer.ts +9 -9
  274. package/src/transformers/features/http/HttpIsQueryTransformer.ts +9 -9
  275. package/src/transformers/features/http/HttpParameterTransformer.ts +9 -9
  276. package/src/transformers/features/http/HttpQueryTransformer.ts +9 -9
  277. package/src/transformers/features/http/HttpValidateFormDataTransformer.ts +10 -10
  278. package/src/transformers/features/http/HttpValidateHeadersTransformer.ts +10 -10
  279. package/src/transformers/features/http/HttpValidateQueryTransformer.ts +9 -9
  280. package/src/transformers/features/json/JsonApplicationTransformer.ts +133 -133
  281. package/src/transformers/features/json/JsonAssertParseTransformer.ts +9 -9
  282. package/src/transformers/features/json/JsonAssertStringifyTransformer.ts +10 -10
  283. package/src/transformers/features/json/JsonCreateAssertParseTransformer.ts +9 -9
  284. package/src/transformers/features/json/JsonCreateAssertStringifyTransformer.ts +12 -12
  285. package/src/transformers/features/json/JsonCreateIsParseTransformer.ts +9 -9
  286. package/src/transformers/features/json/JsonCreateIsStringifyTransformer.ts +9 -9
  287. package/src/transformers/features/json/JsonCreateStringifyTransformer.ts +9 -9
  288. package/src/transformers/features/json/JsonCreateValidateParseTransformer.ts +11 -11
  289. package/src/transformers/features/json/JsonCreateValidateStringifyProgrammer.ts +12 -12
  290. package/src/transformers/features/json/JsonIsParseTransformer.ts +9 -9
  291. package/src/transformers/features/json/JsonIsStringifyTransformer.ts +9 -9
  292. package/src/transformers/features/json/JsonStringifyTransformer.ts +9 -9
  293. package/src/transformers/features/json/JsonValidateParseTransformer.ts +9 -9
  294. package/src/transformers/features/json/JsonValidateStringifyTransformer.ts +10 -10
  295. package/src/transformers/features/misc/MiscAssertCloneTransformer.ts +9 -9
  296. package/src/transformers/features/misc/MiscAssertPruneTransformer.ts +9 -9
  297. package/src/transformers/features/misc/MiscCloneTransformer.ts +9 -9
  298. package/src/transformers/features/misc/MiscCreateAssertCloneTransformer.ts +9 -9
  299. package/src/transformers/features/misc/MiscCreateAssertPruneTransformer.ts +9 -9
  300. package/src/transformers/features/misc/MiscCreateCloneTransformer.ts +9 -9
  301. package/src/transformers/features/misc/MiscCreateIsCloneTransformer.ts +9 -9
  302. package/src/transformers/features/misc/MiscCreateIsPruneTransformer.ts +9 -9
  303. package/src/transformers/features/misc/MiscCreatePruneTransformer.ts +9 -9
  304. package/src/transformers/features/misc/MiscCreateValidateCloneTransformer.ts +11 -11
  305. package/src/transformers/features/misc/MiscCreateValidatePruneTransformer.ts +11 -11
  306. package/src/transformers/features/misc/MiscIsCloneTransformer.ts +9 -9
  307. package/src/transformers/features/misc/MiscIsPruneTransformer.ts +9 -9
  308. package/src/transformers/features/misc/MiscLiteralsTransformer.ts +32 -32
  309. package/src/transformers/features/misc/MiscPruneTransformer.ts +9 -9
  310. package/src/transformers/features/misc/MiscValidateCloneTransformer.ts +9 -9
  311. package/src/transformers/features/misc/MiscValidatePruneTransformer.ts +9 -9
  312. package/src/transformers/features/notations/NotationAssertGeneralTransformer.ts +15 -15
  313. package/src/transformers/features/notations/NotationCreateAssertGeneralTransformer.ts +15 -15
  314. package/src/transformers/features/notations/NotationCreateGeneralTransformer.ts +15 -15
  315. package/src/transformers/features/notations/NotationCreateIsGeneralTransformer.ts +15 -15
  316. package/src/transformers/features/notations/NotationCreateValidateGeneralTransformer.ts +15 -15
  317. package/src/transformers/features/notations/NotationGeneralTransformer.ts +11 -11
  318. package/src/transformers/features/notations/NotationIsGeneralTransformer.ts +15 -15
  319. package/src/transformers/features/notations/NotationValidateGeneralTransformer.ts +15 -15
  320. package/src/transformers/features/protobuf/ProtobufAssertDecodeTransformer.ts +10 -10
  321. package/src/transformers/features/protobuf/ProtobufAssertEncodeTransformer.ts +10 -10
  322. package/src/transformers/features/protobuf/ProtobufCreateAssertDecodeTransformer.ts +12 -12
  323. package/src/transformers/features/protobuf/ProtobufCreateAssertEncodeTransformer.ts +12 -12
  324. package/src/transformers/features/protobuf/ProtobufCreateDecodeTransformer.ts +9 -9
  325. package/src/transformers/features/protobuf/ProtobufCreateEncodeTransformer.ts +9 -9
  326. package/src/transformers/features/protobuf/ProtobufCreateIsDecodeTransformer.ts +9 -9
  327. package/src/transformers/features/protobuf/ProtobufCreateIsEncodeTransformer.ts +9 -9
  328. package/src/transformers/features/protobuf/ProtobufCreateValidateDecodeTransformer.ts +12 -12
  329. package/src/transformers/features/protobuf/ProtobufCreateValidateEncodeTransformer.ts +12 -12
  330. package/src/transformers/features/protobuf/ProtobufDecodeTransformer.ts +9 -9
  331. package/src/transformers/features/protobuf/ProtobufEncodeTransformer.ts +9 -9
  332. package/src/transformers/features/protobuf/ProtobufIsDecodeTransformer.ts +9 -9
  333. package/src/transformers/features/protobuf/ProtobufIsEncodeTransformer.ts +9 -9
  334. package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +33 -33
  335. package/src/transformers/features/protobuf/ProtobufValidateDecodeTransformer.ts +10 -10
  336. package/src/transformers/features/protobuf/ProtobufValidateEncodeTransformer.ts +10 -10
  337. package/src/transformers/features/reflect/ReflectMetadataTransformer.ts +63 -63
  338. package/src/transformers/internal/GenericTransformer.ts +104 -104
  339. package/src/typings/Atomic.ts +13 -13
  340. package/src/typings/ClassProperties.ts +5 -5
  341. package/src/typings/Customizable.ts +5 -5
  342. package/src/typings/OmitNever.ts +3 -3
  343. package/src/typings/ProtobufAtomic.ts +19 -19
  344. package/src/typings/SpecialFields.ts +3 -3
  345. package/src/typings/ValidationPipe.ts +9 -9
  346. package/src/typings/Writable.ts +11 -11
  347. package/src/utils/ArrayUtil.ts +43 -43
  348. package/src/utils/Escaper.ts +46 -46
  349. package/src/utils/MapUtil.ts +12 -12
  350. package/src/utils/NameEncoder.ts +32 -32
  351. package/src/utils/NamingConvention/NamingConvention.ts +86 -86
  352. package/src/utils/NamingConvention/index.ts +1 -1
  353. package/src/utils/PatternUtil.ts +29 -29
  354. package/src/utils/RandomGenerator/RandomGenerator.ts +105 -105
  355. package/src/utils/RandomGenerator/index.ts +1 -1
  356. package/src/utils/Singleton.ts +16 -16
  357. package/src/utils/StringUtil/StringUtil.ts +7 -7
  358. package/src/utils/StringUtil/index.ts +1 -1
package/src/json.ts CHANGED
@@ -1,754 +1,754 @@
1
- import * as Namespace from "./functional/Namespace";
2
-
3
- import { IJsonApplication } from "./schemas/json/IJsonApplication";
4
-
5
- import { IValidation } from "./IValidation";
6
- import { Primitive } from "./Primitive";
7
- import { TypeGuardError } from "./TypeGuardError";
8
-
9
- /* ===========================================================
10
- JSON
11
- - SCHEMA
12
- - PARSE
13
- - STRINGIFY
14
- - FACTORY FUNCTIONS
15
- ==============================================================
16
- SCHEMA
17
- ----------------------------------------------------------- */
18
- /**
19
- * > You must configure the generic argument `Types`.
20
- *
21
- * JSON Schema Application.
22
- *
23
- * Creates a JSON schema application which contains both main JSON schemas and
24
- * components. Note that, all of the named types are stored in the
25
- * {@link IJsonApplication.components} property for the `$ref` referencing.
26
- *
27
- * Also, `typia.json.application()` has two additional generic arguments.
28
- *
29
- * The 1st *Purpose* means the purpose determines the JSON schema definition spec.
30
- * For an example, `ajv` has an extra property "$recursiveRef" that are not
31
- * exists in the standard JSON schema definition spec. Otherwise, `swagger`
32
- * can't identify the tuple definition.
33
- *
34
- * The next *Surplus* means whether to allow surplus properties starting with
35
- * `x-typia-` or not. If `true`, the surplus properties like `x-typia-jsDocTags`
36
- * would be registered into the JSON schema, otherwise, not.
37
- *
38
- * @template Types Tuple of target types
39
- * @template Purpose Purpose of the JSON schema
40
- * @template Surplus Allow surplus properties starting with `x-typia-` or not
41
- * @return JSON schema application
42
- *
43
- * @author Jeongho Nam - https://github.com/samchon
44
- */
45
- export function application(): never;
46
-
47
- /**
48
- * JSON Schema Application.
49
- *
50
- * Creates a JSON schema application which contains both main JSON schemas and
51
- * components. Note that, all of the named types are stored in the
52
- * {@link IJsonApplication.components} property for the `$ref` referencing.
53
- *
54
- * Also, `typia.json.application()` has two additional generic arguments.
55
- *
56
- * The 1st *Purpose* means the purpose determines the JSON schema definition spec.
57
- * For an example, `ajv` has an extra property "$recursiveRef" that are not
58
- * exists in the standard JSON schema definition spec. Otherwise, `swagger`
59
- * can't identify the tuple definition.
60
- *
61
- * The next *Surplus* means whether to allow surplus properties starting with
62
- * `x-typia-` or not. If `true`, the surplus properties like `x-typia-jsDocTags`
63
- * would be registered into the JSON schema, otherwise, not.
64
- *
65
- * @template Types Tuple of target types
66
- * @template Purpose Purpose of the JSON schema
67
- * @template Surplus Allow surplus properties starting with `x-typia-` or not
68
- * @return JSON schema application
69
- *
70
- * @author Jeongho Nam - https://github.com/samchon
71
- */
72
- export function application<
73
- Types extends unknown[],
74
- Purpose extends "ajv" | "swagger" = "swagger",
75
- Surplus extends boolean = false,
76
- >(): IJsonApplication;
77
-
78
- /**
79
- * @internal
80
- */
81
- export function application(): never {
82
- halt("application");
83
- }
84
-
85
- /* -----------------------------------------------------------
86
- PARSE
87
- ----------------------------------------------------------- */
88
- /**
89
- * > You must configure the generic argument `T`.
90
- *
91
- * Safe `JSON.parse()` function with type assertion.
92
- *
93
- * `typia.json.assertParse()` is a combination function of `JSON.parse()` and
94
- * {@link assert}. Therefore, it convers a JSON (JavaScript Object Notation) string
95
- * to a `T` typed instance with type assertion.
96
- *
97
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
98
- * throws {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
99
- * there's no problem on the parsed value, the parsed value would be returned.
100
- *
101
- * @template T Expected type of parsed value
102
- * @param input JSON string
103
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
104
- * @returns Parsed value
105
- *
106
- * @author Jeongho Nam - https://github.com/samchon
107
- */
108
- function assertParse(
109
- input: string,
110
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
111
- ): never;
112
-
113
- /**
114
- * Safe `JSON.parse()` function with type assertion.
115
- *
116
- * `typia.json.assertParse()` is a combination function of `JSON.parse()` and
117
- * {@link assert}. Therefore, it convers a JSON (JavaScript Object Notation) string
118
- * to a `T` typed instance with type assertion.
119
- *
120
- * In such reason, when parsed JSON string value is not matched with the type `T`,
121
- * it throws {@link TypeGuardError} or custom error generated by *errorFactory*.
122
- * Otherwise, there's no problem on the parsed value, the parsed value would be
123
- * returned.
124
- *
125
- * @template T Expected type of parsed value
126
- * @param input JSON string
127
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
128
- * @returns Parsed value
129
- *
130
- * @author Jeongho Nam - https://github.com/samchon
131
- */
132
- function assertParse<T>(
133
- input: string,
134
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
135
- ): Primitive<T>;
136
-
137
- /**
138
- * @internal
139
- */
140
- function assertParse<T>(): Primitive<T> {
141
- halt("assertParse");
142
- }
143
- const assertParsePure = /** @__PURE__ */ Object.assign<typeof assertParse, {}>(
144
- assertParse,
145
- /** @__PURE__ */ Namespace.assert("json.assertParse"),
146
- );
147
- export { assertParsePure as assertParse };
148
-
149
- /**
150
- * > You must configure the generic argument `T`.
151
- *
152
- * Safe `JSON.parse()` function with type checking.
153
- *
154
- * `typia.json.isParse()` is a combination function of `JSON.parse()` and {@link is}.
155
- * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
156
- * instance with type checking.
157
- *
158
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
159
- * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
160
- * value would be returned.
161
- *
162
- * @template T Expected type of parsed value
163
- * @param input JSON string
164
- * @returns Parsed value when exact type, otherwise `null`
165
- *
166
- * @author Jeongho Nam - https://github.com/samchon
167
- */
168
- function isParse(input: string): never;
169
-
170
- /**
171
- * Safe `JSON.parse()` function with type checking.
172
- *
173
- * `typia.json.isParse()` is a combination function of `JSON.parse()` and {@link is}.
174
- * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
175
- * instance with type checking.
176
- *
177
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
178
- * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
179
- * value would be returned.
180
- *
181
- * @template T Expected type of parsed value
182
- * @param input JSON string
183
- * @returns Parsed value when exact type, otherwise `null`
184
- *
185
- * @author Jeongho Nam - https://github.com/samchon
186
- */
187
- function isParse<T>(input: string): Primitive<T> | null;
188
-
189
- /**
190
- * @internal
191
- */
192
- function isParse<T>(): Primitive<T> | null {
193
- halt("isParse");
194
- }
195
- const isParsePure = /** @__PURE__ */ Object.assign<typeof isParse, {}>(
196
- isParse,
197
- /** @__PURE__ */ Namespace.is(),
198
- );
199
- export { isParsePure as isParse };
200
-
201
- /**
202
- * > You must configure the generic argument `T`.
203
- *
204
- * Safe `JSON.parse()` function with detailed type validation.
205
- *
206
- * `typia.json.validateParse()` is a combination function of `JSON.parse()` and
207
- * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
208
- * to a `T` typed instance with detailed type validation.
209
- *
210
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
211
- * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
212
- * there's no problem on the parsed value, the parsed value would be stored in `data`
213
- * property of the output {@link IValidation.ISuccess} instance.
214
- *
215
- * @template T Expected type of parsed value
216
- * @param input JSON string
217
- * @returns Validation result with JSON parsed value
218
- *
219
- * @author Jeongho Nam - https://github.com/samchon
220
- */
221
- function validateParse(input: string): never;
222
-
223
- /**
224
- * Safe `JSON.parse()` function with detailed type validation.
225
- *
226
- * `typia.json.validateParse()` is a combination function of `JSON.parse()` and
227
- * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
228
- * to a `T` typed instance with detailed type validation.
229
- *
230
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
231
- * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
232
- * there's no problem on the parsed value, the parsed value would be stored in `data`
233
- * property of the output {@link IValidation.ISuccess} instance.
234
- *
235
- * @template T Expected type of parsed value
236
- * @param input JSON string
237
- * @returns Validation result with JSON parsed value
238
- *
239
- * @author Jeongho Nam - https://github.com/samchon
240
- */
241
- function validateParse<T>(input: string): IValidation<Primitive<T>>;
242
-
243
- /**
244
- * @internal
245
- */
246
- function validateParse<T>(): IValidation<Primitive<T>> {
247
- halt("validateParse");
248
- }
249
- const validateParsePure = /** @__PURE__ */ Object.assign<
250
- typeof validateParse,
251
- {}
252
- >(validateParse, /** @__PURE__ */ Namespace.validate());
253
- export { validateParsePure as validateParse };
254
-
255
- /* -----------------------------------------------------------
256
- STRINGIFY
257
- ----------------------------------------------------------- */
258
- /**
259
- * 8x faster `JSON.stringify()` function.
260
- *
261
- * Converts an input value to a JSON (JavaScript Object Notation) string, about 8x
262
- * faster than the native `JSON.stringify()` function. The 5x faster principle is
263
- * because it writes an optimized JSON conversion plan, only for the type `T`.
264
- *
265
- * For reference, this `typia.json.stringify()` does not validate the input value type.
266
- * It just believes that the input value is following the type `T`. Therefore, if you
267
- * can't ensure the input value type, it would be better to call one of below
268
- * functions instead.
269
- *
270
- * - {@link assertStringify}
271
- * - {@link isStringify}
272
- * - {@link validateStringify}
273
- *
274
- * @template T Type of the input value
275
- * @param input A value to be converted
276
- * @return JSON string value
277
- *
278
- * @author Jeongho Nam - https://github.com/samchon
279
- */
280
- function stringify<T>(input: T): string;
281
-
282
- /**
283
- * @internal
284
- */
285
- function stringify(): never {
286
- halt("stringify");
287
- }
288
- const stringifyPure = /** @__PURE__ */ Object.assign<typeof stringify, {}>(
289
- stringify,
290
- /** @__PURE__ */ Namespace.json.stringify("stringify"),
291
- );
292
- export { stringifyPure as stringify };
293
-
294
- /**
295
- * 5x faster `JSON.stringify()` function with type assertion.
296
- *
297
- * `typia.json.assertStringify()` is a combination function of {@link assert} and
298
- * {@link stringify}. Therefore, it converts an input value to
299
- * JSON (JavaScript Object Notation) string, with type assertion.
300
- *
301
- * In such reason, when `input` value is not matched with the type `T`, it throws an
302
- * {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
303
- * there's no problem on the `input` value, JSON string would be returned.
304
- *
305
- * For reference, with type assertion, it is even 5x times faster than the native
306
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
307
- * with confidence.
308
- *
309
- * @template T Type of the input value
310
- * @param input A value to be asserted and converted
311
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
312
- * @return JSON string value
313
- *
314
- * @author Jeongho Nam - https://github.com/samchon
315
- */
316
- function assertStringify<T>(
317
- input: T,
318
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
319
- ): string;
320
-
321
- /**
322
- * 5x faster `JSON.stringify()` function with type assertion.
323
- *
324
- * `typia.json.assertStringify()` is a combination function of {@link assert} and
325
- * {@link stringify}. Therefore, it converts an input value to
326
- * JSON (JavaScript Object Notation) string, with type assertion.
327
- *
328
- * In such reason, when `input` value is not matched with the type `T`, it throws an
329
- * {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
330
- * there's no problem on the `input` value, JSON string would be returned.
331
- *
332
- * For reference, with type assertion, it is even 5x times faster than the native
333
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
334
- * with confidence.
335
- *
336
- * @template T Type of the input value
337
- * @param input A value to be asserted and converted
338
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
339
- * @return JSON string value
340
- *
341
- * @author Jeongho Nam - https://github.com/samchon
342
- */
343
- function assertStringify<T>(
344
- input: T,
345
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
346
- ): unknown;
347
-
348
- /**
349
- * @internal
350
- */
351
- function assertStringify(): string {
352
- halt("assertStringify");
353
- }
354
- const assertStringifyPure = /** @__PURE__ */ Object.assign<
355
- typeof assertStringify,
356
- {},
357
- {}
358
- >(
359
- assertStringify,
360
- /** @__PURE__ */ Namespace.assert("json.assertStringify"),
361
- /** @__PURE__ */ Namespace.json.stringify("assertStringify"),
362
- );
363
- export { assertStringifyPure as assertStringify };
364
-
365
- /**
366
- * 7x faster `JSON.stringify()` function with type checking.
367
- *
368
- * `typia.json.stringify()` is a combination function of {@link is} and
369
- * {@link stringify}. Therefore, it converts an input value to JSON
370
- * (JavaScript Object Notation) string, with type checking.
371
- *
372
- * In such reason, when `input` value is not matched with the type `T`, it returns
373
- * `null` value. Otherwise, there's no problem on the `input` value, JSON string
374
- * would be returned.
375
- *
376
- * For reference, with type checking, it is even 7x times faster than the native
377
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
378
- * with confidence.
379
- *
380
- * @template T Type of the input value
381
- * @param input A value to be checked and converted
382
- * @return JSON string value when exact type, otherwise null
383
- *
384
- * @author Jeongho Nam - https://github.com/samchon
385
- */
386
- function isStringify<T>(input: T): string | null;
387
-
388
- /**
389
- * 7x faster `JSON.stringify()` function with type checking.
390
- *
391
- * `typia.json.isStringify()` is a combination function of {@link is} and
392
- * {@link stringify}. Therefore, it converts an input value to JSON
393
- * (JavaScript Object Notation) string, with type checking.
394
- *
395
- * In such reason, when `input` value is not matched with the type `T`, it returns
396
- * `null` value. Otherwise, there's no problem on the `input` value, JSON string
397
- * would be returned.
398
- *
399
- * For reference, with type checking, it is even 7x times faster than the native
400
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
401
- * with confidence.
402
- *
403
- * @template T Type of the input value
404
- * @param input A value to be checked and converted
405
- * @return JSON string value when exact type, otherwise null
406
- *
407
- * @author Jeongho Nam - https://github.com/samchon
408
- */
409
- function isStringify<T>(input: unknown): string | null;
410
-
411
- /**
412
- * @internal
413
- */
414
- function isStringify(): string | null {
415
- halt("isStringify");
416
- }
417
-
418
- const isStringifyPure = /** @__PURE__ */ Object.assign<
419
- typeof isStringify,
420
- {},
421
- {}
422
- >(
423
- isStringify,
424
- /** @__PURE__ */ Namespace.is(),
425
- /** @__PURE__ */ Namespace.json.stringify("isStringify"),
426
- );
427
- export { isStringifyPure as isStringify };
428
-
429
- /**
430
- * 5x faster `JSON.stringify()` function with detailed type validation.
431
- *
432
- * `typia.json.validateStringify()` is a combination function of {@link validate} and
433
- * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
434
- * Notation) string, with detailed type validation.
435
- *
436
- * In such reason, when `input` value is not matched with the type `T`, it returns
437
- * {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
438
- * there's no problem on the `input` value, JSON string would be stored in `data`
439
- * property of the output {@link IValidation.ISuccess} instance.
440
- *
441
- * For reference, with detailed type validation, it is even 5x times faster than the
442
- * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON
443
- * conversion with confidence.
444
- *
445
- * @template T Type of the input value
446
- * @param input A value to be checked and converted
447
- * @returns Validation result with JSON string value
448
- *
449
- * @author Jeongho Nam - https://github.com/samchon
450
- */
451
- function validateStringify<T>(input: T): IValidation<string>;
452
-
453
- /**
454
- * 5x faster `JSON.stringify()` function with detailed type validation.
455
- *
456
- * `typia.json.validateStringify()` is a combination function of {@link validate} and
457
- * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
458
- * Notation) string, with detailed type validation.
459
- *
460
- * In such reason, when `input` value is not matched with the type `T`, it returns
461
- * {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
462
- * there's no problem on the `input` value, JSON string would be stored in `data`
463
- * property of the output {@link IValidation.ISuccess} instance.
464
- *
465
- * For reference, with detailed type validation, it is even 5x times faster than the
466
- * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON
467
- * conversion with confidence.
468
- *
469
- * @template T Type of the input value
470
- * @param input A value to be checked and converted
471
- * @returns Validation result with JSON string value
472
- *
473
- * @author Jeongho Nam - https://github.com/samchon
474
- */
475
- function validateStringify<T>(input: unknown): IValidation<string>;
476
-
477
- /**
478
- * @internal
479
- */
480
- function validateStringify(): IValidation<string> {
481
- halt("validateStringify");
482
- }
483
- const validateStringifyPure = /** @__PURE__ */ Object.assign<
484
- typeof validateStringify,
485
- {},
486
- {}
487
- >(
488
- validateStringify,
489
- /** @__PURE__ */ Namespace.validate(),
490
- /** @__PURE__ */ Namespace.json.stringify("validateStringify"),
491
- );
492
- export { validateStringifyPure as validateStringify };
493
-
494
- /* -----------------------------------------------------------
495
- FACTORY FUNCTIONS
496
- ----------------------------------------------------------- */
497
- /**
498
- * Creates a reusable {@link isParse} function.
499
- *
500
- * @danger You must configure the generic argument `T`
501
- * @returns Nothing until you configure the generic argument `T`
502
- * @throws compile error
503
- *
504
- * @author Jeongho Nam - https://github.com/samchon
505
- */
506
- function createIsParse(): never;
507
-
508
- /**
509
- * Creates a reusable {@link isParse} function.
510
- *
511
- * @template T Expected type of parsed value
512
- * @returns A reusable `isParse` function
513
- *
514
- * @author Jeongho Nam - https://github.com/samchon
515
- */
516
- function createIsParse<T>(): (input: string) => Primitive<T> | null;
517
-
518
- /**
519
- * @internal
520
- */
521
- function createIsParse<T>(): (input: string) => Primitive<T> | null {
522
- halt("createIsParse");
523
- }
524
- const createIsParsePure = /** @__PURE__ */ Object.assign<
525
- typeof createIsParse,
526
- {}
527
- >(createIsParse, isParsePure);
528
- export { createIsParsePure as createIsParse };
529
-
530
- /**
531
- * Creates a reusable {@link assertParse} function.
532
- *
533
- * @danger You must configure the generic argument `T`
534
- * @returns Nothing until you configure the generic argument `T`
535
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
536
- * @throws compile error
537
- *
538
- * @author Jeongho Nam - https://github.com/samchon
539
- */
540
- function createAssertParse(
541
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
542
- ): never;
543
-
544
- /**
545
- * Creates a reusable {@link assertParse} function.
546
- *
547
- * @template T Expected type of parsed value
548
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
549
- * @returns A reusable `assertParse` function
550
- *
551
- * @author Jeongho Nam - https://github.com/samchon
552
- */
553
- function createAssertParse<T>(
554
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
555
- ): (input: string) => Primitive<T>;
556
-
557
- /**
558
- * @internal
559
- */
560
- function createAssertParse<T>(): (input: string) => Primitive<T> {
561
- halt("createAssertParse");
562
- }
563
- const createAssertParsePure = /** @__PURE__ */ Object.assign<
564
- typeof createAssertParse,
565
- {}
566
- >(createAssertParse, assertParsePure);
567
- export { createAssertParsePure as createAssertParse };
568
-
569
- /**
570
- * Creates a reusable {@link validateParse} function.
571
- *
572
- * @danger You must configure the generic argument `T`
573
- * @returns Nothing until you configure the generic argument `T`
574
- * @throws compile error
575
- *
576
- * @author Jeongho Nam - https://github.com/samchon
577
- */
578
- function createValidateParse(): never;
579
-
580
- /**
581
- * Creates a reusable {@link validateParse} function.
582
- *
583
- * @template T Expected type of parsed value
584
- * @returns A reusable `validateParse` function
585
- *
586
- * @author Jeongho Nam - https://github.com/samchon
587
- */
588
- function createValidateParse<T>(): (input: string) => IValidation<Primitive<T>>;
589
-
590
- /**
591
- * @internal
592
- */
593
- function createValidateParse<T>(): (
594
- input: string,
595
- ) => IValidation<Primitive<T>> {
596
- halt("createValidateParse");
597
- }
598
-
599
- const createValidateParsePure = /** @__PURE__ */ Object.assign<
600
- typeof createValidateParse,
601
- {}
602
- >(createValidateParse, validateParsePure);
603
- export { createValidateParsePure as createValidateParse };
604
-
605
- /**
606
- * Creates a reusable {@link stringify} function.
607
- *
608
- * @danger You must configure the generic argument `T`
609
- * @returns Nothing until you configure the generic argument `T`
610
- * @throws compile error
611
- *
612
- * @author Jeongho Nam - https://github.com/samchon
613
- */
614
- function createStringify(): never;
615
-
616
- /**
617
- * Creates a reusable {@link stringify} function.
618
- *
619
- * @template T Type of the input value
620
- * @returns A reusable `stringify` function
621
- *
622
- * @author Jeongho Nam - https://github.com/samchon
623
- */
624
- function createStringify<T>(): (input: T) => string;
625
-
626
- /**
627
- * @internal
628
- */
629
- function createStringify<T>(): (input: T) => string {
630
- halt("createStringify");
631
- }
632
-
633
- const createStringifyPure = /** @__PURE__ */ Object.assign<
634
- typeof createStringify,
635
- {}
636
- >(createStringify, stringifyPure);
637
- export { createStringifyPure as createStringify };
638
-
639
- /**
640
- * Creates a reusable {@link assertStringify} function.
641
- *
642
- * @danger You must configure the generic argument `T`
643
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
644
- * @returns Nothing until you configure the generic argument `T`
645
- * @throws compile error
646
- *
647
- * @author Jeongho Nam - https://github.com/samchon
648
- */
649
- function createAssertStringify(
650
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
651
- ): never;
652
-
653
- /**
654
- * Creates a reusable {@link assertStringify} function.
655
- *
656
- * @template T Type of the input value
657
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
658
- * @returns A reusable `assertStringify` function
659
- *
660
- * @author Jeongho Nam - https://github.com/samchon
661
- */
662
- function createAssertStringify<T>(
663
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
664
- ): (input: unknown) => string;
665
-
666
- /**
667
- * @internal
668
- */
669
- function createAssertStringify(): (input: unknown) => string {
670
- halt("createAssertStringify");
671
- }
672
-
673
- const createAssertStringifyPure = /** @__PURE__ */ Object.assign<
674
- typeof createAssertStringify,
675
- {}
676
- >(createAssertStringify, assertStringifyPure);
677
- export { createAssertStringifyPure as createAssertStringify };
678
-
679
- /**
680
- * Creates a reusable {@link isStringify} function.
681
- *
682
- * @danger You must configure the generic argument `T`
683
- * @returns Nothing until you configure the generic argument `T`
684
- * @throws compile error
685
- *
686
- * @author Jeongho Nam - https://github.com/samchon
687
- */
688
- function createIsStringify(): never;
689
-
690
- /**
691
- * Creates a reusable {@link isStringify} function.
692
- *
693
- * @template T Type of the input value
694
- * @returns A reusable `isStringify` function
695
- *
696
- * @author Jeongho Nam - https://github.com/samchon
697
- */
698
- function createIsStringify<T>(): (input: unknown) => string | null;
699
-
700
- /**
701
- * @internal
702
- */
703
- function createIsStringify(): (input: unknown) => string | null {
704
- halt("createIsStringify");
705
- }
706
-
707
- const createIsStringifyPure = /** @__PURE__ */ Object.assign<
708
- typeof createIsStringify,
709
- {}
710
- >(createIsStringify, isStringifyPure);
711
- export { createIsStringifyPure as createIsStringify };
712
-
713
- /**
714
- * Creates a reusable {@link validateStringify} function.
715
- *
716
- * @danger You must configure the generic argument `T`
717
- * @returns Nothing until you configure the generic argument `T`
718
- * @throws compile error
719
- *
720
- * @author Jeongho Nam - https://github.com/samchon
721
- */
722
- function createValidateStringify(): never;
723
-
724
- /**
725
- * Creates a reusable {@link validateStringify} function.
726
- *
727
- * @template T Type of the input value
728
- * @returns A reusable `validateStringify` function
729
-
730
- * @author Jeongho Nam - https://github.com/samchon
731
- */
732
- function createValidateStringify<T>(): (input: unknown) => IValidation<string>;
733
-
734
- /**
735
- * @internal
736
- */
737
- function createValidateStringify(): (input: unknown) => IValidation<string> {
738
- halt("createValidateStringify");
739
- }
740
-
741
- const createValidateStringifyPure = /** @__PURE__ */ Object.assign<
742
- typeof createValidateStringify,
743
- {}
744
- >(createValidateStringify, validateStringifyPure);
745
- export { createValidateStringifyPure as createValidateStringify };
746
-
747
- /**
748
- * @internal
749
- */
750
- function halt(name: string): never {
751
- throw new Error(
752
- `Error on typia.json.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
753
- );
754
- }
1
+ import * as Namespace from "./functional/Namespace";
2
+
3
+ import { IJsonApplication } from "./schemas/json/IJsonApplication";
4
+
5
+ import { IValidation } from "./IValidation";
6
+ import { Primitive } from "./Primitive";
7
+ import { TypeGuardError } from "./TypeGuardError";
8
+
9
+ /* ===========================================================
10
+ JSON
11
+ - SCHEMA
12
+ - PARSE
13
+ - STRINGIFY
14
+ - FACTORY FUNCTIONS
15
+ ==============================================================
16
+ SCHEMA
17
+ ----------------------------------------------------------- */
18
+ /**
19
+ * > You must configure the generic argument `Types`.
20
+ *
21
+ * JSON Schema Application.
22
+ *
23
+ * Creates a JSON schema application which contains both main JSON schemas and
24
+ * components. Note that, all of the named types are stored in the
25
+ * {@link IJsonApplication.components} property for the `$ref` referencing.
26
+ *
27
+ * Also, `typia.json.application()` has two additional generic arguments.
28
+ *
29
+ * The 1st *Purpose* means the purpose determines the JSON schema definition spec.
30
+ * For an example, `ajv` has an extra property "$recursiveRef" that are not
31
+ * exists in the standard JSON schema definition spec. Otherwise, `swagger`
32
+ * can't identify the tuple definition.
33
+ *
34
+ * The next *Surplus* means whether to allow surplus properties starting with
35
+ * `x-typia-` or not. If `true`, the surplus properties like `x-typia-jsDocTags`
36
+ * would be registered into the JSON schema, otherwise, not.
37
+ *
38
+ * @template Types Tuple of target types
39
+ * @template Purpose Purpose of the JSON schema
40
+ * @template Surplus Allow surplus properties starting with `x-typia-` or not
41
+ * @return JSON schema application
42
+ *
43
+ * @author Jeongho Nam - https://github.com/samchon
44
+ */
45
+ export function application(): never;
46
+
47
+ /**
48
+ * JSON Schema Application.
49
+ *
50
+ * Creates a JSON schema application which contains both main JSON schemas and
51
+ * components. Note that, all of the named types are stored in the
52
+ * {@link IJsonApplication.components} property for the `$ref` referencing.
53
+ *
54
+ * Also, `typia.json.application()` has two additional generic arguments.
55
+ *
56
+ * The 1st *Purpose* means the purpose determines the JSON schema definition spec.
57
+ * For an example, `ajv` has an extra property "$recursiveRef" that are not
58
+ * exists in the standard JSON schema definition spec. Otherwise, `swagger`
59
+ * can't identify the tuple definition.
60
+ *
61
+ * The next *Surplus* means whether to allow surplus properties starting with
62
+ * `x-typia-` or not. If `true`, the surplus properties like `x-typia-jsDocTags`
63
+ * would be registered into the JSON schema, otherwise, not.
64
+ *
65
+ * @template Types Tuple of target types
66
+ * @template Purpose Purpose of the JSON schema
67
+ * @template Surplus Allow surplus properties starting with `x-typia-` or not
68
+ * @return JSON schema application
69
+ *
70
+ * @author Jeongho Nam - https://github.com/samchon
71
+ */
72
+ export function application<
73
+ Types extends unknown[],
74
+ Purpose extends "ajv" | "swagger" = "swagger",
75
+ Surplus extends boolean = false,
76
+ >(): IJsonApplication;
77
+
78
+ /**
79
+ * @internal
80
+ */
81
+ export function application(): never {
82
+ halt("application");
83
+ }
84
+
85
+ /* -----------------------------------------------------------
86
+ PARSE
87
+ ----------------------------------------------------------- */
88
+ /**
89
+ * > You must configure the generic argument `T`.
90
+ *
91
+ * Safe `JSON.parse()` function with type assertion.
92
+ *
93
+ * `typia.json.assertParse()` is a combination function of `JSON.parse()` and
94
+ * {@link assert}. Therefore, it convers a JSON (JavaScript Object Notation) string
95
+ * to a `T` typed instance with type assertion.
96
+ *
97
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
98
+ * throws {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
99
+ * there's no problem on the parsed value, the parsed value would be returned.
100
+ *
101
+ * @template T Expected type of parsed value
102
+ * @param input JSON string
103
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
104
+ * @returns Parsed value
105
+ *
106
+ * @author Jeongho Nam - https://github.com/samchon
107
+ */
108
+ function assertParse(
109
+ input: string,
110
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
111
+ ): never;
112
+
113
+ /**
114
+ * Safe `JSON.parse()` function with type assertion.
115
+ *
116
+ * `typia.json.assertParse()` is a combination function of `JSON.parse()` and
117
+ * {@link assert}. Therefore, it convers a JSON (JavaScript Object Notation) string
118
+ * to a `T` typed instance with type assertion.
119
+ *
120
+ * In such reason, when parsed JSON string value is not matched with the type `T`,
121
+ * it throws {@link TypeGuardError} or custom error generated by *errorFactory*.
122
+ * Otherwise, there's no problem on the parsed value, the parsed value would be
123
+ * returned.
124
+ *
125
+ * @template T Expected type of parsed value
126
+ * @param input JSON string
127
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
128
+ * @returns Parsed value
129
+ *
130
+ * @author Jeongho Nam - https://github.com/samchon
131
+ */
132
+ function assertParse<T>(
133
+ input: string,
134
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
135
+ ): Primitive<T>;
136
+
137
+ /**
138
+ * @internal
139
+ */
140
+ function assertParse<T>(): Primitive<T> {
141
+ halt("assertParse");
142
+ }
143
+ const assertParsePure = /** @__PURE__ */ Object.assign<typeof assertParse, {}>(
144
+ assertParse,
145
+ /** @__PURE__ */ Namespace.assert("json.assertParse"),
146
+ );
147
+ export { assertParsePure as assertParse };
148
+
149
+ /**
150
+ * > You must configure the generic argument `T`.
151
+ *
152
+ * Safe `JSON.parse()` function with type checking.
153
+ *
154
+ * `typia.json.isParse()` is a combination function of `JSON.parse()` and {@link is}.
155
+ * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
156
+ * instance with type checking.
157
+ *
158
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
159
+ * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
160
+ * value would be returned.
161
+ *
162
+ * @template T Expected type of parsed value
163
+ * @param input JSON string
164
+ * @returns Parsed value when exact type, otherwise `null`
165
+ *
166
+ * @author Jeongho Nam - https://github.com/samchon
167
+ */
168
+ function isParse(input: string): never;
169
+
170
+ /**
171
+ * Safe `JSON.parse()` function with type checking.
172
+ *
173
+ * `typia.json.isParse()` is a combination function of `JSON.parse()` and {@link is}.
174
+ * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
175
+ * instance with type checking.
176
+ *
177
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
178
+ * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
179
+ * value would be returned.
180
+ *
181
+ * @template T Expected type of parsed value
182
+ * @param input JSON string
183
+ * @returns Parsed value when exact type, otherwise `null`
184
+ *
185
+ * @author Jeongho Nam - https://github.com/samchon
186
+ */
187
+ function isParse<T>(input: string): Primitive<T> | null;
188
+
189
+ /**
190
+ * @internal
191
+ */
192
+ function isParse<T>(): Primitive<T> | null {
193
+ halt("isParse");
194
+ }
195
+ const isParsePure = /** @__PURE__ */ Object.assign<typeof isParse, {}>(
196
+ isParse,
197
+ /** @__PURE__ */ Namespace.is(),
198
+ );
199
+ export { isParsePure as isParse };
200
+
201
+ /**
202
+ * > You must configure the generic argument `T`.
203
+ *
204
+ * Safe `JSON.parse()` function with detailed type validation.
205
+ *
206
+ * `typia.json.validateParse()` is a combination function of `JSON.parse()` and
207
+ * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
208
+ * to a `T` typed instance with detailed type validation.
209
+ *
210
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
211
+ * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
212
+ * there's no problem on the parsed value, the parsed value would be stored in `data`
213
+ * property of the output {@link IValidation.ISuccess} instance.
214
+ *
215
+ * @template T Expected type of parsed value
216
+ * @param input JSON string
217
+ * @returns Validation result with JSON parsed value
218
+ *
219
+ * @author Jeongho Nam - https://github.com/samchon
220
+ */
221
+ function validateParse(input: string): never;
222
+
223
+ /**
224
+ * Safe `JSON.parse()` function with detailed type validation.
225
+ *
226
+ * `typia.json.validateParse()` is a combination function of `JSON.parse()` and
227
+ * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
228
+ * to a `T` typed instance with detailed type validation.
229
+ *
230
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
231
+ * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
232
+ * there's no problem on the parsed value, the parsed value would be stored in `data`
233
+ * property of the output {@link IValidation.ISuccess} instance.
234
+ *
235
+ * @template T Expected type of parsed value
236
+ * @param input JSON string
237
+ * @returns Validation result with JSON parsed value
238
+ *
239
+ * @author Jeongho Nam - https://github.com/samchon
240
+ */
241
+ function validateParse<T>(input: string): IValidation<Primitive<T>>;
242
+
243
+ /**
244
+ * @internal
245
+ */
246
+ function validateParse<T>(): IValidation<Primitive<T>> {
247
+ halt("validateParse");
248
+ }
249
+ const validateParsePure = /** @__PURE__ */ Object.assign<
250
+ typeof validateParse,
251
+ {}
252
+ >(validateParse, /** @__PURE__ */ Namespace.validate());
253
+ export { validateParsePure as validateParse };
254
+
255
+ /* -----------------------------------------------------------
256
+ STRINGIFY
257
+ ----------------------------------------------------------- */
258
+ /**
259
+ * 8x faster `JSON.stringify()` function.
260
+ *
261
+ * Converts an input value to a JSON (JavaScript Object Notation) string, about 8x
262
+ * faster than the native `JSON.stringify()` function. The 5x faster principle is
263
+ * because it writes an optimized JSON conversion plan, only for the type `T`.
264
+ *
265
+ * For reference, this `typia.json.stringify()` does not validate the input value type.
266
+ * It just believes that the input value is following the type `T`. Therefore, if you
267
+ * can't ensure the input value type, it would be better to call one of below
268
+ * functions instead.
269
+ *
270
+ * - {@link assertStringify}
271
+ * - {@link isStringify}
272
+ * - {@link validateStringify}
273
+ *
274
+ * @template T Type of the input value
275
+ * @param input A value to be converted
276
+ * @return JSON string value
277
+ *
278
+ * @author Jeongho Nam - https://github.com/samchon
279
+ */
280
+ function stringify<T>(input: T): string;
281
+
282
+ /**
283
+ * @internal
284
+ */
285
+ function stringify(): never {
286
+ halt("stringify");
287
+ }
288
+ const stringifyPure = /** @__PURE__ */ Object.assign<typeof stringify, {}>(
289
+ stringify,
290
+ /** @__PURE__ */ Namespace.json.stringify("stringify"),
291
+ );
292
+ export { stringifyPure as stringify };
293
+
294
+ /**
295
+ * 5x faster `JSON.stringify()` function with type assertion.
296
+ *
297
+ * `typia.json.assertStringify()` is a combination function of {@link assert} and
298
+ * {@link stringify}. Therefore, it converts an input value to
299
+ * JSON (JavaScript Object Notation) string, with type assertion.
300
+ *
301
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
302
+ * {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
303
+ * there's no problem on the `input` value, JSON string would be returned.
304
+ *
305
+ * For reference, with type assertion, it is even 5x times faster than the native
306
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
307
+ * with confidence.
308
+ *
309
+ * @template T Type of the input value
310
+ * @param input A value to be asserted and converted
311
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
312
+ * @return JSON string value
313
+ *
314
+ * @author Jeongho Nam - https://github.com/samchon
315
+ */
316
+ function assertStringify<T>(
317
+ input: T,
318
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
319
+ ): string;
320
+
321
+ /**
322
+ * 5x faster `JSON.stringify()` function with type assertion.
323
+ *
324
+ * `typia.json.assertStringify()` is a combination function of {@link assert} and
325
+ * {@link stringify}. Therefore, it converts an input value to
326
+ * JSON (JavaScript Object Notation) string, with type assertion.
327
+ *
328
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
329
+ * {@link TypeGuardError} or custom error generated by *errorFactory*. Otherwise,
330
+ * there's no problem on the `input` value, JSON string would be returned.
331
+ *
332
+ * For reference, with type assertion, it is even 5x times faster than the native
333
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
334
+ * with confidence.
335
+ *
336
+ * @template T Type of the input value
337
+ * @param input A value to be asserted and converted
338
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
339
+ * @return JSON string value
340
+ *
341
+ * @author Jeongho Nam - https://github.com/samchon
342
+ */
343
+ function assertStringify<T>(
344
+ input: T,
345
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
346
+ ): unknown;
347
+
348
+ /**
349
+ * @internal
350
+ */
351
+ function assertStringify(): string {
352
+ halt("assertStringify");
353
+ }
354
+ const assertStringifyPure = /** @__PURE__ */ Object.assign<
355
+ typeof assertStringify,
356
+ {},
357
+ {}
358
+ >(
359
+ assertStringify,
360
+ /** @__PURE__ */ Namespace.assert("json.assertStringify"),
361
+ /** @__PURE__ */ Namespace.json.stringify("assertStringify"),
362
+ );
363
+ export { assertStringifyPure as assertStringify };
364
+
365
+ /**
366
+ * 7x faster `JSON.stringify()` function with type checking.
367
+ *
368
+ * `typia.json.stringify()` is a combination function of {@link is} and
369
+ * {@link stringify}. Therefore, it converts an input value to JSON
370
+ * (JavaScript Object Notation) string, with type checking.
371
+ *
372
+ * In such reason, when `input` value is not matched with the type `T`, it returns
373
+ * `null` value. Otherwise, there's no problem on the `input` value, JSON string
374
+ * would be returned.
375
+ *
376
+ * For reference, with type checking, it is even 7x times faster than the native
377
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
378
+ * with confidence.
379
+ *
380
+ * @template T Type of the input value
381
+ * @param input A value to be checked and converted
382
+ * @return JSON string value when exact type, otherwise null
383
+ *
384
+ * @author Jeongho Nam - https://github.com/samchon
385
+ */
386
+ function isStringify<T>(input: T): string | null;
387
+
388
+ /**
389
+ * 7x faster `JSON.stringify()` function with type checking.
390
+ *
391
+ * `typia.json.isStringify()` is a combination function of {@link is} and
392
+ * {@link stringify}. Therefore, it converts an input value to JSON
393
+ * (JavaScript Object Notation) string, with type checking.
394
+ *
395
+ * In such reason, when `input` value is not matched with the type `T`, it returns
396
+ * `null` value. Otherwise, there's no problem on the `input` value, JSON string
397
+ * would be returned.
398
+ *
399
+ * For reference, with type checking, it is even 7x times faster than the native
400
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
401
+ * with confidence.
402
+ *
403
+ * @template T Type of the input value
404
+ * @param input A value to be checked and converted
405
+ * @return JSON string value when exact type, otherwise null
406
+ *
407
+ * @author Jeongho Nam - https://github.com/samchon
408
+ */
409
+ function isStringify<T>(input: unknown): string | null;
410
+
411
+ /**
412
+ * @internal
413
+ */
414
+ function isStringify(): string | null {
415
+ halt("isStringify");
416
+ }
417
+
418
+ const isStringifyPure = /** @__PURE__ */ Object.assign<
419
+ typeof isStringify,
420
+ {},
421
+ {}
422
+ >(
423
+ isStringify,
424
+ /** @__PURE__ */ Namespace.is(),
425
+ /** @__PURE__ */ Namespace.json.stringify("isStringify"),
426
+ );
427
+ export { isStringifyPure as isStringify };
428
+
429
+ /**
430
+ * 5x faster `JSON.stringify()` function with detailed type validation.
431
+ *
432
+ * `typia.json.validateStringify()` is a combination function of {@link validate} and
433
+ * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
434
+ * Notation) string, with detailed type validation.
435
+ *
436
+ * In such reason, when `input` value is not matched with the type `T`, it returns
437
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
438
+ * there's no problem on the `input` value, JSON string would be stored in `data`
439
+ * property of the output {@link IValidation.ISuccess} instance.
440
+ *
441
+ * For reference, with detailed type validation, it is even 5x times faster than the
442
+ * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON
443
+ * conversion with confidence.
444
+ *
445
+ * @template T Type of the input value
446
+ * @param input A value to be checked and converted
447
+ * @returns Validation result with JSON string value
448
+ *
449
+ * @author Jeongho Nam - https://github.com/samchon
450
+ */
451
+ function validateStringify<T>(input: T): IValidation<string>;
452
+
453
+ /**
454
+ * 5x faster `JSON.stringify()` function with detailed type validation.
455
+ *
456
+ * `typia.json.validateStringify()` is a combination function of {@link validate} and
457
+ * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
458
+ * Notation) string, with detailed type validation.
459
+ *
460
+ * In such reason, when `input` value is not matched with the type `T`, it returns
461
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
462
+ * there's no problem on the `input` value, JSON string would be stored in `data`
463
+ * property of the output {@link IValidation.ISuccess} instance.
464
+ *
465
+ * For reference, with detailed type validation, it is even 5x times faster than the
466
+ * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON
467
+ * conversion with confidence.
468
+ *
469
+ * @template T Type of the input value
470
+ * @param input A value to be checked and converted
471
+ * @returns Validation result with JSON string value
472
+ *
473
+ * @author Jeongho Nam - https://github.com/samchon
474
+ */
475
+ function validateStringify<T>(input: unknown): IValidation<string>;
476
+
477
+ /**
478
+ * @internal
479
+ */
480
+ function validateStringify(): IValidation<string> {
481
+ halt("validateStringify");
482
+ }
483
+ const validateStringifyPure = /** @__PURE__ */ Object.assign<
484
+ typeof validateStringify,
485
+ {},
486
+ {}
487
+ >(
488
+ validateStringify,
489
+ /** @__PURE__ */ Namespace.validate(),
490
+ /** @__PURE__ */ Namespace.json.stringify("validateStringify"),
491
+ );
492
+ export { validateStringifyPure as validateStringify };
493
+
494
+ /* -----------------------------------------------------------
495
+ FACTORY FUNCTIONS
496
+ ----------------------------------------------------------- */
497
+ /**
498
+ * Creates a reusable {@link isParse} function.
499
+ *
500
+ * @danger You must configure the generic argument `T`
501
+ * @returns Nothing until you configure the generic argument `T`
502
+ * @throws compile error
503
+ *
504
+ * @author Jeongho Nam - https://github.com/samchon
505
+ */
506
+ function createIsParse(): never;
507
+
508
+ /**
509
+ * Creates a reusable {@link isParse} function.
510
+ *
511
+ * @template T Expected type of parsed value
512
+ * @returns A reusable `isParse` function
513
+ *
514
+ * @author Jeongho Nam - https://github.com/samchon
515
+ */
516
+ function createIsParse<T>(): (input: string) => Primitive<T> | null;
517
+
518
+ /**
519
+ * @internal
520
+ */
521
+ function createIsParse<T>(): (input: string) => Primitive<T> | null {
522
+ halt("createIsParse");
523
+ }
524
+ const createIsParsePure = /** @__PURE__ */ Object.assign<
525
+ typeof createIsParse,
526
+ {}
527
+ >(createIsParse, isParsePure);
528
+ export { createIsParsePure as createIsParse };
529
+
530
+ /**
531
+ * Creates a reusable {@link assertParse} function.
532
+ *
533
+ * @danger You must configure the generic argument `T`
534
+ * @returns Nothing until you configure the generic argument `T`
535
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
536
+ * @throws compile error
537
+ *
538
+ * @author Jeongho Nam - https://github.com/samchon
539
+ */
540
+ function createAssertParse(
541
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
542
+ ): never;
543
+
544
+ /**
545
+ * Creates a reusable {@link assertParse} function.
546
+ *
547
+ * @template T Expected type of parsed value
548
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
549
+ * @returns A reusable `assertParse` function
550
+ *
551
+ * @author Jeongho Nam - https://github.com/samchon
552
+ */
553
+ function createAssertParse<T>(
554
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
555
+ ): (input: string) => Primitive<T>;
556
+
557
+ /**
558
+ * @internal
559
+ */
560
+ function createAssertParse<T>(): (input: string) => Primitive<T> {
561
+ halt("createAssertParse");
562
+ }
563
+ const createAssertParsePure = /** @__PURE__ */ Object.assign<
564
+ typeof createAssertParse,
565
+ {}
566
+ >(createAssertParse, assertParsePure);
567
+ export { createAssertParsePure as createAssertParse };
568
+
569
+ /**
570
+ * Creates a reusable {@link validateParse} function.
571
+ *
572
+ * @danger You must configure the generic argument `T`
573
+ * @returns Nothing until you configure the generic argument `T`
574
+ * @throws compile error
575
+ *
576
+ * @author Jeongho Nam - https://github.com/samchon
577
+ */
578
+ function createValidateParse(): never;
579
+
580
+ /**
581
+ * Creates a reusable {@link validateParse} function.
582
+ *
583
+ * @template T Expected type of parsed value
584
+ * @returns A reusable `validateParse` function
585
+ *
586
+ * @author Jeongho Nam - https://github.com/samchon
587
+ */
588
+ function createValidateParse<T>(): (input: string) => IValidation<Primitive<T>>;
589
+
590
+ /**
591
+ * @internal
592
+ */
593
+ function createValidateParse<T>(): (
594
+ input: string,
595
+ ) => IValidation<Primitive<T>> {
596
+ halt("createValidateParse");
597
+ }
598
+
599
+ const createValidateParsePure = /** @__PURE__ */ Object.assign<
600
+ typeof createValidateParse,
601
+ {}
602
+ >(createValidateParse, validateParsePure);
603
+ export { createValidateParsePure as createValidateParse };
604
+
605
+ /**
606
+ * Creates a reusable {@link stringify} function.
607
+ *
608
+ * @danger You must configure the generic argument `T`
609
+ * @returns Nothing until you configure the generic argument `T`
610
+ * @throws compile error
611
+ *
612
+ * @author Jeongho Nam - https://github.com/samchon
613
+ */
614
+ function createStringify(): never;
615
+
616
+ /**
617
+ * Creates a reusable {@link stringify} function.
618
+ *
619
+ * @template T Type of the input value
620
+ * @returns A reusable `stringify` function
621
+ *
622
+ * @author Jeongho Nam - https://github.com/samchon
623
+ */
624
+ function createStringify<T>(): (input: T) => string;
625
+
626
+ /**
627
+ * @internal
628
+ */
629
+ function createStringify<T>(): (input: T) => string {
630
+ halt("createStringify");
631
+ }
632
+
633
+ const createStringifyPure = /** @__PURE__ */ Object.assign<
634
+ typeof createStringify,
635
+ {}
636
+ >(createStringify, stringifyPure);
637
+ export { createStringifyPure as createStringify };
638
+
639
+ /**
640
+ * Creates a reusable {@link assertStringify} function.
641
+ *
642
+ * @danger You must configure the generic argument `T`
643
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
644
+ * @returns Nothing until you configure the generic argument `T`
645
+ * @throws compile error
646
+ *
647
+ * @author Jeongho Nam - https://github.com/samchon
648
+ */
649
+ function createAssertStringify(
650
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
651
+ ): never;
652
+
653
+ /**
654
+ * Creates a reusable {@link assertStringify} function.
655
+ *
656
+ * @template T Type of the input value
657
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
658
+ * @returns A reusable `assertStringify` function
659
+ *
660
+ * @author Jeongho Nam - https://github.com/samchon
661
+ */
662
+ function createAssertStringify<T>(
663
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
664
+ ): (input: unknown) => string;
665
+
666
+ /**
667
+ * @internal
668
+ */
669
+ function createAssertStringify(): (input: unknown) => string {
670
+ halt("createAssertStringify");
671
+ }
672
+
673
+ const createAssertStringifyPure = /** @__PURE__ */ Object.assign<
674
+ typeof createAssertStringify,
675
+ {}
676
+ >(createAssertStringify, assertStringifyPure);
677
+ export { createAssertStringifyPure as createAssertStringify };
678
+
679
+ /**
680
+ * Creates a reusable {@link isStringify} function.
681
+ *
682
+ * @danger You must configure the generic argument `T`
683
+ * @returns Nothing until you configure the generic argument `T`
684
+ * @throws compile error
685
+ *
686
+ * @author Jeongho Nam - https://github.com/samchon
687
+ */
688
+ function createIsStringify(): never;
689
+
690
+ /**
691
+ * Creates a reusable {@link isStringify} function.
692
+ *
693
+ * @template T Type of the input value
694
+ * @returns A reusable `isStringify` function
695
+ *
696
+ * @author Jeongho Nam - https://github.com/samchon
697
+ */
698
+ function createIsStringify<T>(): (input: unknown) => string | null;
699
+
700
+ /**
701
+ * @internal
702
+ */
703
+ function createIsStringify(): (input: unknown) => string | null {
704
+ halt("createIsStringify");
705
+ }
706
+
707
+ const createIsStringifyPure = /** @__PURE__ */ Object.assign<
708
+ typeof createIsStringify,
709
+ {}
710
+ >(createIsStringify, isStringifyPure);
711
+ export { createIsStringifyPure as createIsStringify };
712
+
713
+ /**
714
+ * Creates a reusable {@link validateStringify} function.
715
+ *
716
+ * @danger You must configure the generic argument `T`
717
+ * @returns Nothing until you configure the generic argument `T`
718
+ * @throws compile error
719
+ *
720
+ * @author Jeongho Nam - https://github.com/samchon
721
+ */
722
+ function createValidateStringify(): never;
723
+
724
+ /**
725
+ * Creates a reusable {@link validateStringify} function.
726
+ *
727
+ * @template T Type of the input value
728
+ * @returns A reusable `validateStringify` function
729
+
730
+ * @author Jeongho Nam - https://github.com/samchon
731
+ */
732
+ function createValidateStringify<T>(): (input: unknown) => IValidation<string>;
733
+
734
+ /**
735
+ * @internal
736
+ */
737
+ function createValidateStringify(): (input: unknown) => IValidation<string> {
738
+ halt("createValidateStringify");
739
+ }
740
+
741
+ const createValidateStringifyPure = /** @__PURE__ */ Object.assign<
742
+ typeof createValidateStringify,
743
+ {}
744
+ >(createValidateStringify, validateStringifyPure);
745
+ export { createValidateStringifyPure as createValidateStringify };
746
+
747
+ /**
748
+ * @internal
749
+ */
750
+ function halt(name: string): never {
751
+ throw new Error(
752
+ `Error on typia.json.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
753
+ );
754
+ }