typia 5.0.0-dev.20230823 → 5.0.0-dev.2023084

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 (217) hide show
  1. package/lib/Primitive.d.ts +14 -12
  2. package/lib/Resolved.d.ts +46 -0
  3. package/lib/{schemas/metadata/IMetadataResolved.js → Resolved.js} +1 -1
  4. package/lib/Resolved.js.map +1 -0
  5. package/lib/factories/MetadataFactory.d.ts +1 -1
  6. package/lib/factories/MetadataTagFactory.js +10 -8
  7. package/lib/factories/MetadataTagFactory.js.map +1 -1
  8. package/lib/factories/ProtobufFactory.js +4 -3
  9. package/lib/factories/ProtobufFactory.js.map +1 -1
  10. package/lib/factories/internal/metadata/emend_metadata_atomics.js +6 -6
  11. package/lib/factories/internal/metadata/emend_metadata_atomics.js.map +1 -1
  12. package/lib/factories/internal/metadata/explore_metadata.js +3 -3
  13. package/lib/factories/internal/metadata/explore_metadata.js.map +1 -1
  14. package/lib/factories/internal/metadata/iterate_metadata_atomic.js +1 -1
  15. package/lib/factories/internal/metadata/iterate_metadata_atomic.js.map +1 -1
  16. package/lib/factories/internal/metadata/iterate_metadata_collection.js +6 -6
  17. package/lib/factories/internal/metadata/iterate_metadata_collection.js.map +1 -1
  18. package/lib/factories/internal/metadata/iterate_metadata_native.js +2 -10
  19. package/lib/factories/internal/metadata/iterate_metadata_native.js.map +1 -1
  20. package/lib/factories/internal/metadata/iterate_metadata_resolve.js +6 -6
  21. package/lib/factories/internal/metadata/iterate_metadata_resolve.js.map +1 -1
  22. package/lib/factories/internal/metadata/iterate_metadata_sort.js +2 -2
  23. package/lib/factories/internal/metadata/iterate_metadata_sort.js.map +1 -1
  24. package/lib/functional/$ProtobufWriter.js.map +1 -1
  25. package/lib/json.d.ts +15 -15
  26. package/lib/misc.d.ts +42 -42
  27. package/lib/module.d.ts +18 -17
  28. package/lib/module.js +1 -0
  29. package/lib/module.js.map +1 -1
  30. package/lib/programmers/AssertProgrammer.js +1 -1
  31. package/lib/programmers/AssertProgrammer.js.map +1 -1
  32. package/lib/programmers/CheckerProgrammer.js +7 -7
  33. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  34. package/lib/programmers/IsProgrammer.js +2 -2
  35. package/lib/programmers/IsProgrammer.js.map +1 -1
  36. package/lib/programmers/RandomProgrammer.js +311 -136
  37. package/lib/programmers/RandomProgrammer.js.map +1 -1
  38. package/lib/programmers/ValidateProgrammer.js +1 -1
  39. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  40. package/lib/programmers/helpers/AtomicPredicator.js +2 -2
  41. package/lib/programmers/helpers/AtomicPredicator.js.map +1 -1
  42. package/lib/programmers/helpers/FunctionImporeter.d.ts +2 -0
  43. package/lib/programmers/helpers/FunctionImporeter.js +2 -1
  44. package/lib/programmers/helpers/FunctionImporeter.js.map +1 -1
  45. package/lib/programmers/helpers/ProtobufUtil.js +2 -2
  46. package/lib/programmers/helpers/ProtobufUtil.js.map +1 -1
  47. package/lib/programmers/helpers/StringifyPredicator.js +1 -2
  48. package/lib/programmers/helpers/StringifyPredicator.js.map +1 -1
  49. package/lib/programmers/helpers/disable_function_importer_declare.js +1 -0
  50. package/lib/programmers/helpers/disable_function_importer_declare.js.map +1 -1
  51. package/lib/programmers/internal/application_default_string.js +2 -2
  52. package/lib/programmers/internal/application_default_string.js.map +1 -1
  53. package/lib/programmers/internal/application_resolved.d.ts +2 -2
  54. package/lib/programmers/internal/application_resolved.js.map +1 -1
  55. package/lib/programmers/internal/application_schema.js +7 -7
  56. package/lib/programmers/internal/application_schema.js.map +1 -1
  57. package/lib/programmers/internal/metadata_to_pattern.js +4 -4
  58. package/lib/programmers/internal/metadata_to_pattern.js.map +1 -1
  59. package/lib/programmers/internal/stringify_dynamic_properties.js +2 -1
  60. package/lib/programmers/internal/stringify_dynamic_properties.js.map +1 -1
  61. package/lib/programmers/json/JsonStringifyProgrammer.js +20 -14
  62. package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
  63. package/lib/programmers/misc/MiscAssertCloneProgrammer.js +1 -1
  64. package/lib/programmers/misc/MiscAssertCloneProgrammer.js.map +1 -1
  65. package/lib/programmers/misc/MiscCloneProgrammer.js +114 -33
  66. package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
  67. package/lib/programmers/misc/MiscIsCloneProgrammer.js +1 -1
  68. package/lib/programmers/misc/MiscIsCloneProgrammer.js.map +1 -1
  69. package/lib/programmers/misc/MiscLiteralsProgrammer.js +3 -3
  70. package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
  71. package/lib/programmers/misc/MiscPruneProgrammer.js +2 -2
  72. package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
  73. package/lib/programmers/misc/MiscValidateCloneProgrammer.js +1 -1
  74. package/lib/programmers/misc/MiscValidateCloneProgrammer.js.map +1 -1
  75. package/lib/programmers/protobuf/ProtobufAssertDecodeProgrammer.js +3 -3
  76. package/lib/programmers/protobuf/ProtobufAssertDecodeProgrammer.js.map +1 -1
  77. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +3 -3
  78. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
  79. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +1 -1
  80. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
  81. package/lib/programmers/protobuf/ProtobufIsDecodeProgrammer.js +2 -2
  82. package/lib/programmers/protobuf/ProtobufIsDecodeProgrammer.js.map +1 -1
  83. package/lib/programmers/protobuf/ProtobufValidateDecodeProgrammer.js +1 -1
  84. package/lib/programmers/protobuf/ProtobufValidateDecodeProgrammer.js.map +1 -1
  85. package/lib/protobuf.d.ts +631 -10
  86. package/lib/protobuf.js +13 -13
  87. package/lib/protobuf.js.map +1 -1
  88. package/lib/schemas/metadata/IMetadata.d.ts +4 -4
  89. package/lib/schemas/metadata/IMetadataAtomic.d.ts +12 -0
  90. package/lib/schemas/metadata/IMetadataAtomic.js +3 -0
  91. package/lib/schemas/metadata/IMetadataAtomic.js.map +1 -0
  92. package/lib/schemas/metadata/{IMetadataResolved.d.ts → IMetadataEscaped.d.ts} +1 -1
  93. package/lib/schemas/metadata/IMetadataEscaped.js +3 -0
  94. package/lib/schemas/metadata/IMetadataEscaped.js.map +1 -0
  95. package/lib/schemas/metadata/Metadata.d.ts +4 -4
  96. package/lib/schemas/metadata/Metadata.js +64 -59
  97. package/lib/schemas/metadata/Metadata.js.map +1 -1
  98. package/lib/schemas/metadata/{MetadataResolved.d.ts → MetadataEscaped.d.ts} +3 -3
  99. package/lib/schemas/metadata/{MetadataResolved.js → MetadataEscaped.js} +11 -11
  100. package/lib/schemas/metadata/MetadataEscaped.js.map +1 -0
  101. package/lib/tags/ExclusiveMaximum.d.ts +8 -0
  102. package/lib/tags/ExclusiveMaximum.js +3 -0
  103. package/lib/tags/ExclusiveMaximum.js.map +1 -0
  104. package/lib/tags/ExclusiveMinimum.d.ts +8 -0
  105. package/lib/tags/ExclusiveMinimum.js +3 -0
  106. package/lib/tags/ExclusiveMinimum.js.map +1 -0
  107. package/lib/tags/Format.d.ts +8 -0
  108. package/lib/tags/Format.js +3 -0
  109. package/lib/tags/Format.js.map +1 -0
  110. package/lib/tags/MaxItems.d.ts +8 -0
  111. package/lib/tags/MaxItems.js +3 -0
  112. package/lib/tags/MaxItems.js.map +1 -0
  113. package/lib/tags/MaxLength.d.ts +8 -0
  114. package/lib/tags/MaxLength.js +3 -0
  115. package/lib/tags/MaxLength.js.map +1 -0
  116. package/lib/tags/Maximum.d.ts +8 -0
  117. package/lib/tags/Maximum.js +3 -0
  118. package/lib/tags/Maximum.js.map +1 -0
  119. package/lib/tags/MinItems.d.ts +8 -0
  120. package/lib/tags/MinItems.js +3 -0
  121. package/lib/tags/MinItems.js.map +1 -0
  122. package/lib/tags/MinLength.d.ts +8 -0
  123. package/lib/tags/MinLength.js +3 -0
  124. package/lib/tags/MinLength.js.map +1 -0
  125. package/lib/tags/Minimum.d.ts +8 -0
  126. package/lib/tags/Minimum.js +3 -0
  127. package/lib/tags/Minimum.js.map +1 -0
  128. package/lib/tags/MultipleOf.d.ts +8 -0
  129. package/lib/tags/MultipleOf.js +3 -0
  130. package/lib/tags/MultipleOf.js.map +1 -0
  131. package/lib/tags/Pattern.d.ts +8 -0
  132. package/lib/tags/Pattern.js +3 -0
  133. package/lib/tags/Pattern.js.map +1 -0
  134. package/lib/tags/TagBase.d.ts +10 -0
  135. package/lib/tags/TagBase.js +3 -0
  136. package/lib/tags/TagBase.js.map +1 -0
  137. package/lib/tags/Type.d.ts +13 -0
  138. package/lib/tags/Type.js +3 -0
  139. package/lib/tags/Type.js.map +1 -0
  140. package/lib/tags/index.d.ts +12 -0
  141. package/lib/tags/index.js +29 -0
  142. package/lib/tags/index.js.map +1 -0
  143. package/lib/transformers/features/json/JsonApplicationTransformer.js +2 -2
  144. package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
  145. package/lib/transformers/features/misc/MetadataTransformer.js +1 -1
  146. package/lib/transformers/features/misc/MetadataTransformer.js.map +1 -1
  147. package/lib/utils/RandomGenerator.js +3 -2
  148. package/lib/utils/RandomGenerator.js.map +1 -1
  149. package/package.json +2 -1
  150. package/src/Primitive.ts +135 -131
  151. package/src/Resolved.ts +116 -0
  152. package/src/factories/MetadataFactory.ts +46 -46
  153. package/src/factories/MetadataTagFactory.ts +366 -364
  154. package/src/factories/ProtobufFactory.ts +268 -266
  155. package/src/factories/internal/metadata/emend_metadata_atomics.ts +35 -33
  156. package/src/factories/internal/metadata/explore_metadata.ts +38 -38
  157. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +63 -59
  158. package/src/factories/internal/metadata/iterate_metadata_collection.ts +133 -133
  159. package/src/factories/internal/metadata/iterate_metadata_native.ts +210 -219
  160. package/src/factories/internal/metadata/iterate_metadata_resolve.ts +49 -49
  161. package/src/factories/internal/metadata/iterate_metadata_sort.ts +69 -69
  162. package/src/functional/$ProtobufWriter.ts +151 -151
  163. package/src/json.ts +648 -648
  164. package/src/misc.ts +651 -651
  165. package/src/module.ts +709 -708
  166. package/src/programmers/AssertProgrammer.ts +281 -279
  167. package/src/programmers/CheckerProgrammer.ts +1174 -1173
  168. package/src/programmers/IsProgrammer.ts +241 -239
  169. package/src/programmers/RandomProgrammer.ts +874 -578
  170. package/src/programmers/ValidateProgrammer.ts +307 -305
  171. package/src/programmers/helpers/AtomicPredicator.ts +31 -31
  172. package/src/programmers/helpers/FunctionImporeter.ts +91 -89
  173. package/src/programmers/helpers/ProtobufUtil.ts +29 -29
  174. package/src/programmers/helpers/StringifyPredicator.ts +12 -13
  175. package/src/programmers/helpers/disable_function_importer_declare.ts +32 -27
  176. package/src/programmers/internal/application_default_string.ts +37 -33
  177. package/src/programmers/internal/application_resolved.ts +55 -55
  178. package/src/programmers/internal/application_schema.ts +157 -157
  179. package/src/programmers/internal/metadata_to_pattern.ts +34 -34
  180. package/src/programmers/internal/stringify_dynamic_properties.ts +171 -171
  181. package/src/programmers/json/JsonStringifyProgrammer.ts +995 -987
  182. package/src/programmers/misc/MiscAssertCloneProgrammer.ts +71 -71
  183. package/src/programmers/misc/MiscCloneProgrammer.ts +775 -587
  184. package/src/programmers/misc/MiscIsCloneProgrammer.ts +78 -78
  185. package/src/programmers/misc/MiscLiteralsProgrammer.ts +64 -64
  186. package/src/programmers/misc/MiscPruneProgrammer.ts +544 -542
  187. package/src/programmers/misc/MiscValidateCloneProgrammer.ts +85 -85
  188. package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +75 -66
  189. package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +673 -669
  190. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +814 -814
  191. package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +85 -75
  192. package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +75 -75
  193. package/src/protobuf.ts +881 -249
  194. package/src/schemas/metadata/IMetadata.ts +27 -28
  195. package/src/schemas/metadata/IMetadataAtomic.ts +13 -0
  196. package/src/schemas/metadata/{IMetadataResolved.ts → IMetadataEscaped.ts} +6 -6
  197. package/src/schemas/metadata/Metadata.ts +643 -637
  198. package/src/schemas/metadata/{MetadataResolved.ts → MetadataEscaped.ts} +51 -51
  199. package/src/tags/ExclusiveMaximum.ts +8 -0
  200. package/src/tags/ExclusiveMinimum.ts +8 -0
  201. package/src/tags/Format.ts +29 -0
  202. package/src/tags/MaxItems.ts +8 -0
  203. package/src/tags/MaxLength.ts +8 -0
  204. package/src/tags/Maximum.ts +8 -0
  205. package/src/tags/MinItems.ts +8 -0
  206. package/src/tags/MinLength.ts +8 -0
  207. package/src/tags/Minimum.ts +8 -0
  208. package/src/tags/MultipleOf.ts +10 -0
  209. package/src/tags/Pattern.ts +8 -0
  210. package/src/tags/TagBase.ts +17 -0
  211. package/src/tags/Type.ts +30 -0
  212. package/src/tags/index.ts +12 -0
  213. package/src/transformers/features/json/JsonApplicationTransformer.ts +111 -111
  214. package/src/transformers/features/misc/MetadataTransformer.ts +53 -53
  215. package/src/utils/RandomGenerator.ts +83 -81
  216. package/lib/schemas/metadata/IMetadataResolved.js.map +0 -1
  217. package/lib/schemas/metadata/MetadataResolved.js.map +0 -1
package/lib/protobuf.d.ts CHANGED
@@ -1,31 +1,652 @@
1
1
  import { IValidation } from "./IValidation";
2
+ import { Resolved } from "./Resolved";
3
+ /**
4
+ * > You must configure the generic argument `T`.
5
+ *
6
+ * Protocol Buffer Message Schema.
7
+ *
8
+ * Creates a Protocol Buffer Message Schema from a TypeScript type. The message
9
+ * schema would be returned as a string value, and it can be used to share with
10
+ * other developers/languages/frameworks.
11
+ *
12
+ * For reference, Protocol Buffer has lots of restrictions, so that expression power
13
+ * of Protocol Buffer is not enough strong to fully meet the TypeScript type specs.
14
+ * In such reason, if you put a TypeScript type that is not compatible with Protocol
15
+ * Buffer, this function would throw a compilation error.
16
+ *
17
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
18
+ *
19
+ * @template T Target type
20
+ * @returns Protocol Buffer Message Schema.
21
+ *
22
+ * @author Jeongho Nam - https://github.com/samchon
23
+ */
2
24
  export declare function message(): never;
25
+ /**
26
+ * Protocol Buffer Message Schema.
27
+ *
28
+ * Creates a Protocol Buffer Message Schema from a TypeScript type. The message
29
+ * schema would be returned as a string value, and it can be used to share with
30
+ * other developers/languages/frameworks.
31
+ *
32
+ * For reference, Protocol Buffer has lots of restrictions, so that expression power
33
+ * of Protocol Buffer is not enough strong to fully meet the TypeScript type specs.
34
+ * In such reason, if you put a TypeScript type that is not compatible with Protocol
35
+ * Buffer, this function would throw a compilation error.
36
+ *
37
+ * @template T Target type
38
+ * @returns Protocol Buffer Message Schema.
39
+ *
40
+ * @author Jeongho Nam - https://github.com/samchon
41
+ */
3
42
  export declare function message<T>(): string;
43
+ /**
44
+ * > You must configure the generic argument `T`.
45
+ *
46
+ * Protocol Buffer Decoder.
47
+ *
48
+ * `typia.protobuf.decode()` is a function decoding a binary data of Protocol Buffer
49
+ * format to a TypeScript instance.
50
+ *
51
+ * For reference, as Protocol Buffer handles binary data directly, there's no way
52
+ * when `input` binary data was not encoded from the `T` typed value. In that case,
53
+ * unexpected behavior or internal error would be occured. Therefore, I recommend you
54
+ * to encode binary data of Protocol Buffer from type safe encode function like below.
55
+ * Use {@link encode} function only when you can ensure it.
56
+ *
57
+ * - {@link assertEncode}
58
+ * - {@link isEncode}
59
+ * - {@link validateEncode}
60
+ *
61
+ * Also, `typia` is providing a type safe decoder like {@link assertDecode}, but it
62
+ * is just for additional validation like whether a string value meets constant
63
+ * restriction, or a numeric value is keepking its range limit, represented by
64
+ * [comment tags](https://typia.io/docs/validators/tags). Thus, I repeat that,
65
+ * you've to ensure the type safety when using decoder functions.
66
+ *
67
+ * @tempate Expected type of decoded value
68
+ * @param input Protobuf Buffer binary data
69
+ * @returns Decoded value
70
+ *
71
+ * @author Jeongho Nam - https://github.com/samchon
72
+ */
4
73
  export declare function decode(input: Uint8Array): never;
5
- export declare function decode<T>(input: Uint8Array): T;
6
- export declare function isDecode(input: Uint8Array): never;
7
- export declare function isDecode<T>(input: Uint8Array): T | null;
74
+ /**
75
+ * Protocol Buffer Decoder.
76
+ *
77
+ * `typia.protobuf.decode()` is a function decoding a binary data of Protocol Buffer
78
+ * format to a TypeScript instance.
79
+ *
80
+ * For reference, as Protocol Buffer handles binary data directly, there's no way
81
+ * when `input` binary data was not encoded from the `T` typed value. In that case,
82
+ * unexpected behavior or internal error would be occured. Therefore, I recommend you
83
+ * to encode binary data of Protocol Buffer from type safe encode function like below.
84
+ * Use {@link encode} function only when you can ensure it.
85
+ *
86
+ * - {@link assertEncode}
87
+ * - {@link isEncode}
88
+ * - {@link validateEncode}
89
+ *
90
+ * Also, `typia` is providing a type safe decoder like {@link assertDecode}, but it
91
+ * is just for additional validation like whether a string value meets constant
92
+ * restriction, or a numeric value is keepking its range limit, represented by
93
+ * [comment tags](https://typia.io/docs/validators/tags). Thus, I repeat that,
94
+ * you've to ensure the type safety when using decoder functions.
95
+ *
96
+ * @tempate Expected type of decoded value
97
+ * @param input Protobuf Buffer binary data
98
+ * @returns Decoded value
99
+ *
100
+ * @author Jeongho Nam - https://github.com/samchon
101
+ */
102
+ export declare function decode<T>(input: Uint8Array): Resolved<T>;
103
+ /**
104
+ * > You must configure the generic argument `T`.
105
+ *
106
+ * Protocol Buffer Decoder wity type assertion, but not safe.
107
+ *
108
+ * `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
109
+ * {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
110
+ * a TypeScript instance, and performs type assertion process. If decoded value is
111
+ * following the type `T`, it returns the decoded value. Otherwise, it throws
112
+ * {@link TypeGuardError} instead.
113
+ *
114
+ * However, note that, this validation is not always safe. It just performs additional
115
+ * type checking like whether a string value meets constant restriction, or a
116
+ * numeric value is keepking its range limit, represented by
117
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
118
+ * decode functions, you have to ensure the type safety by yourself.
119
+ *
120
+ * In such type safety reason, I recommend you to use type safe encode functions.
121
+ *
122
+ * - {@link assertEncode}
123
+ * - {@link isEncode}
124
+ * - {@link validateEncode}
125
+ *
126
+ * @tempate Expected type of decoded value
127
+ * @param input Protobuf Buffer binary data
128
+ * @returns Decoded value
129
+ *
130
+ * @author Jeongho Nam - https://github.com/samchon
131
+ */
8
132
  export declare function assertDecode(input: Uint8Array): never;
9
- export declare function assertDecode<T>(input: Uint8Array): T;
133
+ /**
134
+ * Protocol Buffer Decoder wity type assertion, but not safe.
135
+ *
136
+ * `typia.protobuf.assertDecode()` is a combination function of {@link decode} and
137
+ * {@link assert} function. Therefore, it decodes a binary data of Protocol Buffer to
138
+ * a TypeScript instance, and performs type assertion process. If decoded value is
139
+ * following the type `T`, it returns the decoded value. Otherwise, it throws
140
+ * {@link TypeGuardError} instead.
141
+ *
142
+ * However, note that, this validation is not always safe. It just performs additional
143
+ * type checking like whether a string value meets constant restriction, or a
144
+ * numeric value is keepking its range limit, represented by
145
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
146
+ * decode functions, you have to ensure the type safety by yourself.
147
+ *
148
+ * In such type safety reason, I recommend you to use type safe encode functions.
149
+ *
150
+ * - {@link assertEncode}
151
+ * - {@link isEncode}
152
+ * - {@link validateEncode}
153
+ *
154
+ * @tempate Expected type of decoded value
155
+ * @param input Protobuf Buffer binary data
156
+ * @returns Decoded value
157
+ *
158
+ * @author Jeongho Nam - https://github.com/samchon
159
+ */
160
+ export declare function assertDecode<T>(input: Uint8Array): Resolved<T>;
161
+ /**
162
+ * > You must configure the generic argument `T`.
163
+ *
164
+ * Protocol Buffer Decoder wity type checking, but not safe.
165
+ *
166
+ * `typia.protobuf.isDecode()` is a combination function of {@link decode} and
167
+ * {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
168
+ * a TypeScript instance, and performs type checking process. If decoded value is
169
+ * following the type `T`, it returns the decoded value. Otherwise, it returns
170
+ * `null` value instead.
171
+ *
172
+ * However, note that, this validation is not always safe. It just performs additional
173
+ * type checking like whether a string value meets constant restriction, or a
174
+ * numeric value is keepking its range limit, represented by
175
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
176
+ * decode functions, you have to ensure the type safety by yourself.
177
+ *
178
+ * In such type safety reason, I recommend you to use type safe encode functions.
179
+ *
180
+ * - {@link assertEncode}
181
+ * - {@link isEncode}
182
+ * - {@link validateEncode}
183
+ *
184
+ * @tempate Expected type of decoded value
185
+ * @param input Protobuf Buffer binary data
186
+ * @returns Decoded value
187
+ *
188
+ * @author Jeongho Nam - https://github.com/samchon
189
+ */
190
+ export declare function isDecode(input: Uint8Array): never;
191
+ /**
192
+ * Protocol Buffer Decoder wity type checking, but not safe.
193
+ *
194
+ * `typia.protobuf.isDecode()` is a combination function of {@link decode} and
195
+ * {@link is} function. Therefore, it decodes a binary data of Protocol Buffer to
196
+ * a TypeScript instance, and performs type checking process. If decoded value is
197
+ * following the type `T`, it returns the decoded value. Otherwise, it returns
198
+ * `null` value instead.
199
+ *
200
+ * However, note that, this validation is not always safe. It just performs additional
201
+ * type checking like whether a string value meets constant restriction, or a
202
+ * numeric value is keepking its range limit, represented by
203
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
204
+ * decode functions, you have to ensure the type safety by yourself.
205
+ *
206
+ * In such type safety reason, I recommend you to use type safe encode functions.
207
+ *
208
+ * - {@link assertEncode}
209
+ * - {@link isEncode}
210
+ * - {@link validateEncode}
211
+ *
212
+ * @tempate Expected type of decoded value
213
+ * @param input Protobuf Buffer binary data
214
+ * @returns Decoded value
215
+ *
216
+ * @author Jeongho Nam - https://github.com/samchon
217
+ */
218
+ export declare function isDecode<T>(input: Uint8Array): Resolved<T> | null;
219
+ /**
220
+ * > You must configure the generic argument `T`.
221
+ *
222
+ * Protocol Buffer Decoder wity type validation, but not safe.
223
+ *
224
+ * `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
225
+ * {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
226
+ * a TypeScript instance, and performs type validation process. If decoded value is
227
+ * following the type `T`, it returns the decoded value with
228
+ * {@link IValidation.ISuccess} typed instance. Otherwise, it returns
229
+ * {@link IValidation.IFailure} value instead with detailed error reasons.
230
+ *
231
+ * However, note that, this validation is not always safe. It just performs additional
232
+ * type checking like whether a string value meets constant restriction, or a
233
+ * numeric value is keepking its range limit, represented by
234
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
235
+ * decode functions, you have to ensure the type safety by yourself.
236
+ *
237
+ * In such type safety reason, I recommend you to use type safe encode functions.
238
+ *
239
+ * - {@link assertEncode}
240
+ * - {@link isEncode}
241
+ * - {@link validateEncode}
242
+ *
243
+ * @tempate Expected type of decoded value
244
+ * @param input Protobuf Buffer binary data
245
+ * @returns Decoded value
246
+ *
247
+ * @author Jeongho Nam - https://github.com/samchon
248
+ */
10
249
  export declare function validateDecode(input: Uint8Array): never;
11
- export declare function validateDecode<T>(input: Uint8Array): IValidation<T>;
250
+ /**
251
+ * Protocol Buffer Decoder wity type validation, but not safe.
252
+ *
253
+ * `typia.protobuf.validateDecode()` is a combination function of {@link decode} and
254
+ * {@link validate} function. Therefore, it decodes a binary data of Protocol Buffer to
255
+ * a TypeScript instance, and performs type validation process. If decoded value is
256
+ * following the type `T`, it returns the decoded value with
257
+ * {@link IValidation.ISuccess} typed instance. Otherwise, it returns
258
+ * {@link IValidation.IFailure} value instead with detailed error reasons.
259
+ *
260
+ * However, note that, this validation is not always safe. It just performs additional
261
+ * type checking like whether a string value meets constant restriction, or a
262
+ * numeric value is keepking its range limit, represented by
263
+ * [comment tags](https://typia.io/docs/validators/tags). Therefore, when using
264
+ * decode functions, you have to ensure the type safety by yourself.
265
+ *
266
+ * In such type safety reason, I recommend you to use type safe encode functions.
267
+ *
268
+ * - {@link assertEncode}
269
+ * - {@link isEncode}
270
+ * - {@link validateEncode}
271
+ *
272
+ * @tempate Expected type of decoded value
273
+ * @param input Protobuf Buffer binary data
274
+ * @returns Decoded value
275
+ *
276
+ * @author Jeongho Nam - https://github.com/samchon
277
+ */
278
+ export declare function validateDecode<T>(input: Uint8Array): IValidation<Resolved<T>>;
279
+ /**
280
+ * Protocol Buffer Encoder.
281
+ *
282
+ * Converts an input value to a binary data of Protocol Buffer format.
283
+ *
284
+ * For reference, this `typia.protobuf.encode()` does not validate the `input` value.
285
+ * It just believes that the `input` value is valid and converts it to a binary data
286
+ * directly. Therefore, if you can't ensure the `input` value type, it would better to
287
+ * call one of below functions intead.
288
+ *
289
+ * - {@link assertEncode}
290
+ * - {@link isEncode}
291
+ * - {@link validateEncode}
292
+ *
293
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
294
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
295
+ * type that is not compatible with Protocol Buffer, this function would throw a
296
+ * compilation error.
297
+ *
298
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
299
+ *
300
+ * @template T Type of the value input
301
+ * @param input A value to encode
302
+ * @returns Encoded binary data
303
+ *
304
+ * @author Jeongho Nam - https://github.com/samchon
305
+ */
12
306
  export declare function encode<T>(input: T): Uint8Array;
13
- export declare function isEncode<T>(input: T): Uint8Array | null;
307
+ /**
308
+ * Protocol Buffer Encoder with type assertion.
309
+ *
310
+ * `typia.protobuf.assertEncode()` is a combination function of {@link assert} and
311
+ * {@link encode}.
312
+ *
313
+ * Therefore, it converts an `input` value to a binary data of
314
+ * Protocol Buffer, with type assertion. If `input` value is not valid, it throws
315
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value,
316
+ * Protocol Buffer binary data would be returned.
317
+ *
318
+ * If you can trust `input` value, or want to perform other type of validation, use
319
+ * below functions intead.
320
+ *
321
+ * - {@link encode}
322
+ * - {@link isEncode}
323
+ * - {@link validateEncode}
324
+ *
325
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
326
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
327
+ * type that is not compatible with Protocol Buffer, this function would throw a
328
+ * compilation error.
329
+ *
330
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
331
+ *
332
+ * @template T Type of the value input
333
+ * @param input A value to encode
334
+ * @returns Encoded binary data
335
+ *
336
+ * @author Jeongho Nam - https://github.com/samchon
337
+ */
14
338
  export declare function assertEncode<T>(input: T): Uint8Array;
339
+ /**
340
+ * Protocol Buffer Encoder with type assertion.
341
+ *
342
+ * `typia.protobuf.assertEncode()` is a combination function of {@link assert} and
343
+ * {@link encode}.
344
+ *
345
+ * Therefore, it converts an `input` value to a binary data of
346
+ * Protocol Buffer, with type assertion. If `input` value is not valid, it throws
347
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value,
348
+ * Protocol Buffer binary data would be returned.
349
+ *
350
+ * If you can trust `input` value, or want to perform other type of validation, use
351
+ * below functions intead.
352
+ *
353
+ * - {@link encode}
354
+ * - {@link isEncode}
355
+ * - {@link validateEncode}
356
+ *
357
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
358
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
359
+ * type that is not compatible with Protocol Buffer, this function would throw a
360
+ * compilation error.
361
+ *
362
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
363
+ *
364
+ * @template T Type of the value input
365
+ * @param input A value to encode
366
+ * @returns Encoded binary data
367
+ *
368
+ * @author Jeongho Nam - https://github.com/samchon
369
+ */
370
+ export declare function assertEncode<T>(input: unknown): Uint8Array;
371
+ /**
372
+ * Protocol Buffer Encoder with type checking.
373
+ *
374
+ * `typia.protobuf.isEncode()` is a combination function of {@link is} and
375
+ * {@link encode}.
376
+ *
377
+ * Therefore, it converts an `input` value to a binary data of
378
+ * Protocol Buffer, with type checking. If `input` value is not valid, it returns
379
+ * `null` value. Otherwise, there's no problem on the `input` value, Protocol
380
+ * Buffer binary data would be returned.
381
+ *
382
+ * If you can trust `input` value, or want to perform other type of validation, use
383
+ * below functions intead.
384
+ *
385
+ * - {@link encode}
386
+ * - {@link assertEncode}
387
+ * - {@link validateEncode}
388
+ *
389
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
390
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
391
+ * type that is not compatible with Protocol Buffer, this function would throw a
392
+ * compilation error.
393
+ *
394
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
395
+ *
396
+ * @template T Type of the value input
397
+ * @param input A value to encode
398
+ * @returns Encoded binary data
399
+ *
400
+ * @author Jeongho Nam - https://github.com/samchon
401
+ */
402
+ export declare function isEncode<T>(input: T): Uint8Array | null;
403
+ /**
404
+ * Protocol Buffer Encoder with type checking.
405
+ *
406
+ * `typia.protobuf.isEncode()` is a combination function of {@link is} and
407
+ * {@link encode}.
408
+ *
409
+ * Therefore, it converts an `input` value to a binary data of
410
+ * Protocol Buffer, with type checking. If `input` value is not valid, it returns
411
+ * `null` value. Otherwise, there's no problem on the `input` value, Protocol
412
+ * Buffer binary data would be returned.
413
+ *
414
+ * If you can trust `input` value, or want to perform other type of validation, use
415
+ * below functions intead.
416
+ *
417
+ * - {@link encode}
418
+ * - {@link assertEncode}
419
+ * - {@link validateEncode}
420
+ *
421
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
422
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
423
+ * type that is not compatible with Protocol Buffer, this function would throw a
424
+ * compilation error.
425
+ *
426
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
427
+ *
428
+ * @template T Type of the value input
429
+ * @param input A value to encode
430
+ * @returns Encoded binary data
431
+ *
432
+ * @author Jeongho Nam - https://github.com/samchon
433
+ */
434
+ export declare function isEncode<T>(input: unknown): Uint8Array | null;
435
+ /**
436
+ * Protocol Buffer Encoder with type validation.
437
+ *
438
+ * `typia.protobuf.validateEncode()` is a combination function of
439
+ * {@link validation} and {@link encode}.
440
+ *
441
+ * Therefore, it converts an `input` value to a binary data of
442
+ * Protocol Buffer, with type validation. If `input` value is not valid, it returns
443
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
444
+ * no problem on the `input` value, Protocol Buffer binary data would be stored in
445
+ * `data` property of the output {@link IValidation.ISuccess} instance.
446
+ *
447
+ * If you can trust `input` value, or want to perform other type of validation, use
448
+ * below functions intead.
449
+ *
450
+ * - {@link encode}
451
+ * - {@link assertEncode}
452
+ * - {@link isEncode}
453
+ *
454
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
455
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
456
+ * type that is not compatible with Protocol Buffer, this function would throw a
457
+ * compilation error.
458
+ *
459
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
460
+ *
461
+ * @template T Type of the value input
462
+ * @param input A value to encode
463
+ * @returns Encoded binary data
464
+ *
465
+ * @author Jeongho Nam - https://github.com/samchon
466
+ */
15
467
  export declare function validateEncode<T>(input: T): IValidation<Uint8Array>;
468
+ /**
469
+ * Protocol Buffer Encoder with type validation.
470
+ *
471
+ * `typia.protobuf.validateEncode()` is a combination function of
472
+ * {@link validation} and {@link encode}.
473
+ *
474
+ * Therefore, it converts an `input` value to a binary data of
475
+ * Protocol Buffer, with type validation. If `input` value is not valid, it returns
476
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise, there's
477
+ * no problem on the `input` value, Protocol Buffer binary data would be stored in
478
+ * `data` property of the output {@link IValidation.ISuccess} instance.
479
+ *
480
+ * If you can trust `input` value, or want to perform other type of validation, use
481
+ * below functions intead.
482
+ *
483
+ * - {@link encode}
484
+ * - {@link assertEncode}
485
+ * - {@link isEncode}
486
+ *
487
+ * By the way, you know what? Expression power of Protocol Buffer is not enough strong
488
+ * to fully meet the TypeScript type specs. In such reason, if you put a TypeScript
489
+ * type that is not compatible with Protocol Buffer, this function would throw a
490
+ * compilation error.
491
+ *
492
+ * - [Restrictions of Protocol Buffer](https://typia.io/docs/protobuf/message/#restrictions)
493
+ *
494
+ * @template T Type of the value input
495
+ * @param input A value to encode
496
+ * @returns Encoded binary data
497
+ *
498
+ * @author Jeongho Nam - https://github.com/samchon
499
+ */
500
+ export declare function validateEncode<T>(input: unknown): IValidation<Uint8Array>;
501
+ /**
502
+ * Creates a reusable {@link decode} function.
503
+ *
504
+ * @danger You must configure the generic argument `T`
505
+ * @returns Nothing until you configure the generic argument `T`
506
+ * @throws compile error
507
+ *
508
+ * @author Jeongho Nam - https://github.com/samchon
509
+ */
16
510
  export declare function createDecode(): never;
17
- export declare function createDecode<T>(): (input: Uint8Array) => T;
511
+ /**
512
+ * Creates a reusable {@link decode} function.
513
+ *
514
+ * @template T Target type
515
+ * @returns A reusable `decode` function
516
+ *
517
+ * @author Jeongho Nam - https://github.com/samchon
518
+ */
519
+ export declare function createDecode<T>(): (input: Uint8Array) => Resolved<T>;
520
+ /**
521
+ * Creates a reusable {@link isDecode} function.
522
+ *
523
+ * @danger You must configure the generic argument `T`
524
+ * @returns Nothing until you configure the generic argument `T`
525
+ * @throws compile error
526
+ *
527
+ * @author Jeongho Nam - https://github.com/samchon
528
+ */
18
529
  export declare function createIsDecode(): never;
19
- export declare function createIsDecode<T>(): (input: Uint8Array) => T | null;
530
+ /**
531
+ * Creates a reusable {@link isDecode} function.
532
+ *
533
+ * @template T Target type
534
+ * @returns A reusable `isDecode` function
535
+ *
536
+ * @author Jeongho Nam - https://github.com/samchon
537
+ */
538
+ export declare function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null;
539
+ /**
540
+ * Creates a reusable {@link assertDecode} function.
541
+ *
542
+ * @danger You must configure the generic argument `T`
543
+ * @returns Nothing until you configure the generic argument `T`
544
+ * @throws compile error
545
+ *
546
+ * @author Jeongho Nam - https://github.com/samchon
547
+ */
20
548
  export declare function createAssertDecode(): never;
21
- export declare function createAssertDecode<T>(): (input: Uint8Array) => T;
549
+ /**
550
+ * Creates a reusable {@link assertDecode} function.
551
+ *
552
+ * @template T Target type
553
+ * @returns A reusable `assertDecode` function
554
+ *
555
+ * @author Jeongho Nam - https://github.com/samchon
556
+ */
557
+ export declare function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T>;
558
+ /**
559
+ * Creates a reusable {@link validateDecode} function.
560
+ *
561
+ * @danger You must configure the generic argument `T`
562
+ * @returns Nothing until you configure the generic argument `T`
563
+ * @throws compile error
564
+ *
565
+ * @author Jeongho Nam - https://github.com/samchon
566
+ */
22
567
  export declare function createValidateDecode(): never;
23
- export declare function createValidateDecode<T>(): (input: Uint8Array) => IValidation<T>;
568
+ /**
569
+ * Creates a reusable {@link validateDecode} function.
570
+ *
571
+ * @template T Target type
572
+ * @returns A reusable `validateDecode` function
573
+ *
574
+ * @author Jeongho Nam - https://github.com/samchon
575
+ */
576
+ export declare function createValidateDecode<T>(): (input: Uint8Array) => IValidation<Resolved<T>>;
577
+ /**
578
+ * Creates a reusable {@link encode} function.
579
+ *
580
+ * @danger You must configure the generic argument `T`
581
+ * @returns Nothing until you configure the generic argument `T`
582
+ * @throws compile error
583
+ *
584
+ * @author Jeongho Nam - https://github.com/samchon
585
+ */
24
586
  export declare function createEncode(): never;
587
+ /**
588
+ * Creates a reusable {@link encode} function.
589
+ *
590
+ * @template T Target type
591
+ * @returns A reusable `encode` function
592
+ *
593
+ * @author Jeongho Nam - https://github.com/samchon
594
+ */
25
595
  export declare function createEncode<T>(): (input: T) => Uint8Array;
596
+ /**
597
+ * Creates a reusable {@link isEncode} function.
598
+ *
599
+ * @danger You must configure the generic argument `T`
600
+ * @returns Nothing until you configure the generic argument `T`
601
+ * @throws compile error
602
+ *
603
+ * @author Jeongho Nam - https://github.com/samchon
604
+ */
26
605
  export declare function createIsEncode(): never;
606
+ /**
607
+ * Creates a reusable {@link isEncode} function.
608
+ *
609
+ * @template T Target type
610
+ * @returns A reusable `isEncode` function
611
+ *
612
+ * @author Jeongho Nam - https://github.com/samchon
613
+ */
27
614
  export declare function createIsEncode<T>(): (input: T) => Uint8Array | null;
615
+ /**
616
+ * Creates a reusable {@link assertEncode} function.
617
+ *
618
+ * @danger You must configure the generic argument `T`
619
+ * @returns Nothing until you configure the generic argument `T`
620
+ * @throws compile error
621
+ *
622
+ * @author Jeongho Nam - https://github.com/samchon
623
+ */
28
624
  export declare function createAssertEncode(): never;
625
+ /**
626
+ * Creates a reusable {@link assertEncode} function.
627
+ *
628
+ * @template T Target type
629
+ * @returns A reusable `assertEncode` function
630
+ *
631
+ * @author Jeongho Nam - https://github.com/samchon
632
+ */
29
633
  export declare function createAssertEncode<T>(): (input: T) => Uint8Array;
634
+ /**
635
+ * Creates a reusable {@link validateEncode} function.
636
+ *
637
+ * @danger You must configure the generic argument `T`
638
+ * @returns Nothing until you configure the generic argument `T`
639
+ * @throws compile error
640
+ *
641
+ * @author Jeongho Nam - https://github.com/samchon
642
+ */
30
643
  export declare function createValidateEncode(): never;
644
+ /**
645
+ * Creates a reusable {@link validateEncode} function.
646
+ *
647
+ * @template T Target type
648
+ * @returns A reusable `validateEncode` function
649
+ *
650
+ * @author Jeongho Nam - https://github.com/samchon
651
+ */
31
652
  export declare function createValidateEncode<T>(): (input: T) => IValidation<Uint8Array>;