typia 12.0.0-dev.20260309 → 12.0.0-dev.20260310

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 (134) hide show
  1. package/lib/executable/setup/PluginConfigurator.js +3 -3
  2. package/lib/executable/setup/PluginConfigurator.mjs +3 -3
  3. package/lib/executable/setup/PluginConfigurator.mjs.map +1 -1
  4. package/lib/executable/typia.js +15 -15
  5. package/lib/executable/typia.mjs +15 -15
  6. package/package.json +5 -5
  7. package/src/TypeGuardError.ts +145 -145
  8. package/src/executable/TypiaGenerateWizard.ts +82 -82
  9. package/src/executable/TypiaPatchWizard.ts +45 -45
  10. package/src/executable/TypiaSetupWizard.ts +171 -171
  11. package/src/executable/setup/ArgumentParser.ts +42 -42
  12. package/src/executable/setup/CommandExecutor.ts +8 -8
  13. package/src/executable/setup/FileRetriever.ts +19 -19
  14. package/src/executable/setup/PackageManager.ts +87 -87
  15. package/src/executable/setup/PluginConfigurator.ts +74 -74
  16. package/src/executable/typia.ts +55 -55
  17. package/src/functional.ts +600 -600
  18. package/src/http.ts +843 -843
  19. package/src/index.ts +4 -4
  20. package/src/internal/_IProtobufWriter.ts +18 -18
  21. package/src/internal/_ProtobufReader.ts +187 -187
  22. package/src/internal/_ProtobufSizer.ts +137 -137
  23. package/src/internal/_ProtobufWriter.ts +135 -135
  24. package/src/internal/_accessExpressionAsString.ts +46 -46
  25. package/src/internal/_assertGuard.ts +13 -13
  26. package/src/internal/_coerceLlmArguments.ts +7 -7
  27. package/src/internal/_createStandardSchema.ts +133 -133
  28. package/src/internal/_functionalTypeGuardErrorFactory.ts +4 -4
  29. package/src/internal/_httpFormDataReadArray.ts +4 -4
  30. package/src/internal/_httpFormDataReadBigint.ts +18 -18
  31. package/src/internal/_httpFormDataReadBlob.ts +10 -10
  32. package/src/internal/_httpFormDataReadBoolean.ts +16 -16
  33. package/src/internal/_httpFormDataReadFile.ts +10 -10
  34. package/src/internal/_httpFormDataReadNumber.ts +15 -15
  35. package/src/internal/_httpFormDataReadString.ts +10 -10
  36. package/src/internal/_httpHeaderReadBigint.ts +10 -10
  37. package/src/internal/_httpHeaderReadBoolean.ts +8 -8
  38. package/src/internal/_httpHeaderReadNumber.ts +7 -7
  39. package/src/internal/_httpParameterReadBigint.ts +10 -10
  40. package/src/internal/_httpParameterReadBoolean.ts +8 -8
  41. package/src/internal/_httpParameterReadNumber.ts +7 -7
  42. package/src/internal/_httpParameterReadString.ts +2 -2
  43. package/src/internal/_httpQueryParseURLSearchParams.ts +12 -12
  44. package/src/internal/_httpQueryReadArray.ts +4 -4
  45. package/src/internal/_httpQueryReadBigint.ts +12 -12
  46. package/src/internal/_httpQueryReadBoolean.ts +14 -14
  47. package/src/internal/_httpQueryReadNumber.ts +9 -9
  48. package/src/internal/_httpQueryReadString.ts +4 -4
  49. package/src/internal/_isBetween.ts +2 -2
  50. package/src/internal/_isBigintString.ts +8 -8
  51. package/src/internal/_isFormatByte.ts +7 -7
  52. package/src/internal/_isFormatDate.ts +3 -3
  53. package/src/internal/_isFormatDateTime.ts +4 -4
  54. package/src/internal/_isFormatDuration.ts +4 -4
  55. package/src/internal/_isFormatEmail.ts +4 -4
  56. package/src/internal/_isFormatHostname.ts +4 -4
  57. package/src/internal/_isFormatIdnEmail.ts +4 -4
  58. package/src/internal/_isFormatIdnHostname.ts +4 -4
  59. package/src/internal/_isFormatIpv4.ts +4 -4
  60. package/src/internal/_isFormatIpv6.ts +4 -4
  61. package/src/internal/_isFormatIri.ts +3 -3
  62. package/src/internal/_isFormatIriReference.ts +4 -4
  63. package/src/internal/_isFormatJsonPointer.ts +3 -3
  64. package/src/internal/_isFormatPassword.ts +1 -1
  65. package/src/internal/_isFormatRegex.ts +8 -8
  66. package/src/internal/_isFormatRelativeJsonPointer.ts +4 -4
  67. package/src/internal/_isFormatTime.ts +4 -4
  68. package/src/internal/_isFormatUri.ts +6 -6
  69. package/src/internal/_isFormatUriReference.ts +5 -5
  70. package/src/internal/_isFormatUriTemplate.ts +4 -4
  71. package/src/internal/_isFormatUrl.ts +4 -4
  72. package/src/internal/_isFormatUuid.ts +3 -3
  73. package/src/internal/_isTypeFloat.ts +5 -5
  74. package/src/internal/_isTypeInt32.ts +5 -5
  75. package/src/internal/_isTypeInt64.ts +5 -5
  76. package/src/internal/_isTypeUint32.ts +5 -5
  77. package/src/internal/_isTypeUint64.ts +5 -5
  78. package/src/internal/_isUniqueItems.ts +159 -159
  79. package/src/internal/_jsonStringifyNumber.ts +12 -12
  80. package/src/internal/_jsonStringifyRest.ts +3 -3
  81. package/src/internal/_jsonStringifyString.ts +42 -42
  82. package/src/internal/_jsonStringifyTail.ts +2 -2
  83. package/src/internal/_llmApplicationFinalize.ts +24 -24
  84. package/src/internal/_miscCloneAny.ts +46 -46
  85. package/src/internal/_notationAny.ts +37 -37
  86. package/src/internal/_notationCamel.ts +13 -13
  87. package/src/internal/_notationPascal.ts +8 -8
  88. package/src/internal/_notationSnake.ts +43 -43
  89. package/src/internal/_parseLlmArguments.ts +7 -7
  90. package/src/internal/_randomArray.ts +21 -21
  91. package/src/internal/_randomBigint.ts +6 -6
  92. package/src/internal/_randomBoolean.ts +1 -1
  93. package/src/internal/_randomFormatByte.ts +3 -3
  94. package/src/internal/_randomFormatDate.ts +18 -18
  95. package/src/internal/_randomFormatDatetime.ts +16 -16
  96. package/src/internal/_randomFormatDuration.ts +27 -27
  97. package/src/internal/_randomFormatEmail.ts +11 -11
  98. package/src/internal/_randomFormatHostname.ts +6 -6
  99. package/src/internal/_randomFormatIdnEmail.ts +3 -3
  100. package/src/internal/_randomFormatIdnHostname.ts +3 -3
  101. package/src/internal/_randomFormatIpv4.ts +11 -11
  102. package/src/internal/_randomFormatIpv6.ts +11 -11
  103. package/src/internal/_randomFormatIri.ts +3 -3
  104. package/src/internal/_randomFormatIriReference.ts +3 -3
  105. package/src/internal/_randomFormatJsonPointer.ts +7 -7
  106. package/src/internal/_randomFormatPassword.ts +8 -8
  107. package/src/internal/_randomFormatRegex.ts +4 -4
  108. package/src/internal/_randomFormatRelativeJsonPointer.ts +8 -8
  109. package/src/internal/_randomFormatTime.ts +14 -14
  110. package/src/internal/_randomFormatUri.ts +3 -3
  111. package/src/internal/_randomFormatUriReference.ts +3 -3
  112. package/src/internal/_randomFormatUriTemplate.ts +3 -3
  113. package/src/internal/_randomFormatUrl.ts +11 -11
  114. package/src/internal/_randomFormatUuid.ts +6 -6
  115. package/src/internal/_randomInteger.ts +53 -53
  116. package/src/internal/_randomNumber.ts +80 -80
  117. package/src/internal/_randomPattern.ts +10 -10
  118. package/src/internal/_randomPick.ts +9 -9
  119. package/src/internal/_randomString.ts +24 -24
  120. package/src/internal/_throwTypeGuardError.ts +5 -5
  121. package/src/internal/_validateReport.ts +21 -21
  122. package/src/internal/private/__notationCapitalize.ts +2 -2
  123. package/src/internal/private/__notationUnsnake.ts +24 -24
  124. package/src/json.ts +553 -553
  125. package/src/llm.ts +408 -408
  126. package/src/misc.ts +448 -448
  127. package/src/module.ts +811 -811
  128. package/src/notations.ts +624 -624
  129. package/src/programmers/TypiaProgrammer.ts +8 -8
  130. package/src/protobuf.ts +499 -499
  131. package/src/re-exports.ts +33 -33
  132. package/src/reflect.ts +75 -75
  133. package/src/transform.ts +5 -5
  134. package/src/transformers/NoTransformConfigurationError.ts +16 -16
package/src/protobuf.ts CHANGED
@@ -1,499 +1,499 @@
1
- import { IValidation, Resolved } from "@typia/interface";
2
-
3
- import { TypeGuardError } from "./TypeGuardError";
4
- import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
5
-
6
- /* ===========================================================
7
- PROTOCOL BUFFER
8
- - MESSAGE
9
- - DECODE
10
- - ENCODE
11
- - FACTORY FUNCTIONS
12
- ==============================================================
13
- SCHEMA
14
- ----------------------------------------------------------- */
15
- /**
16
- * Generates Protocol Buffer message schema.
17
- *
18
- * @danger You must configure the generic argument `T`
19
- */
20
- export function message(): never;
21
-
22
- /**
23
- * Generates Protocol Buffer message schema for type `T`.
24
- *
25
- * Creates a `.proto` message definition string from a TypeScript type. Use for
26
- * sharing schemas with other languages/frameworks.
27
- *
28
- * Protocol Buffer has limited expressiveness compared to TypeScript.
29
- * Incompatible types cause compilation errors.
30
- *
31
- * @template T Target type
32
- * @returns Protocol Buffer message schema string
33
- * @see https://typia.io/docs/protobuf/message/#restrictions
34
- */
35
- export function message<T>(): string;
36
-
37
- /** @internal */
38
- export function message(): never {
39
- NoTransformConfigurationError("protobuf.message");
40
- }
41
-
42
- /* -----------------------------------------------------------
43
- DECODE
44
- ----------------------------------------------------------- */
45
- /**
46
- * Decodes Protocol Buffer binary.
47
- *
48
- * @danger You must configure the generic argument `T`
49
- */
50
- export function decode(input: Uint8Array): never;
51
-
52
- /**
53
- * Decodes Protocol Buffer binary to type `T`.
54
- *
55
- * Converts Protocol Buffer binary data to a TypeScript instance. Binary data
56
- * must have been encoded from a `T`-typed value—invalid data causes undefined
57
- * behavior or errors.
58
- *
59
- * For type safety, ensure data was encoded via:
60
- *
61
- * - {@link assertEncode} — Encodes with type assertion
62
- * - {@link isEncode} — Encodes with type checking
63
- * - {@link validateEncode} — Encodes with validation
64
- *
65
- * Note: Decoder validation ({@link assertDecode}, etc.) only checks custom tags
66
- * like `number & Minimum<7>`, not structural type safety.
67
- *
68
- * @template T Target type
69
- * @param input Protocol Buffer binary data
70
- * @returns Decoded value of type `T`
71
- */
72
- export function decode<T>(input: Uint8Array): Resolved<T>;
73
-
74
- /** @internal */
75
- export function decode(): never {
76
- NoTransformConfigurationError("protobuf.decode");
77
- }
78
-
79
- /**
80
- * Decodes Protocol Buffer binary with assertion.
81
- *
82
- * @danger You must configure the generic argument `T`
83
- */
84
- export function assertDecode(
85
- input: Uint8Array,
86
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
87
- ): never;
88
-
89
- /**
90
- * Decodes Protocol Buffer binary with assertion (partial safety).
91
- *
92
- * Combines {@link decode} with {@link assert}. Throws {@link TypeGuardError} on
93
- * validation failure.
94
- *
95
- * Warning: Only validates custom tags (e.g., `number & Minimum<7>`, `string &
96
- * Format<"uuid">`), not structural type correctness. Ensure source data was
97
- * encoded with type-safe encoders.
98
- *
99
- * Related functions:
100
- *
101
- * - {@link decode} — No validation
102
- * - {@link isDecode} — Returns `null` instead of throwing
103
- * - {@link validateDecode} — Returns detailed validation errors
104
- *
105
- * @template T Target type
106
- * @param input Protocol Buffer binary data
107
- * @param errorFactory Custom error factory receiving
108
- * {@link TypeGuardError.IProps}
109
- * @returns Decoded value of type `T`
110
- * @throws {TypeGuardError} When custom tag validation fails
111
- */
112
- export function assertDecode<T>(
113
- input: Uint8Array,
114
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
115
- ): Resolved<T>;
116
-
117
- /** @internal */
118
- export function assertDecode(): never {
119
- NoTransformConfigurationError("protobuf.assertDecode");
120
- }
121
-
122
- /**
123
- * Decodes Protocol Buffer binary with type checking.
124
- *
125
- * @danger You must configure the generic argument `T`
126
- */
127
- export function isDecode(input: Uint8Array): never;
128
-
129
- /**
130
- * Decodes Protocol Buffer binary with type checking (partial safety).
131
- *
132
- * Combines {@link decode} with {@link is}. Returns `null` on validation failure.
133
- *
134
- * Warning: Only validates custom tags (e.g., `number & Minimum<7>`, `string &
135
- * Format<"uuid">`), not structural type correctness. Ensure source data was
136
- * encoded with type-safe encoders.
137
- *
138
- * Related functions:
139
- *
140
- * - {@link decode} — No validation
141
- * - {@link assertDecode} — Throws instead of returning `null`
142
- * - {@link validateDecode} — Returns detailed validation errors
143
- *
144
- * @template T Target type
145
- * @param input Protocol Buffer binary data
146
- * @returns Decoded value of type `T`, or `null` if invalid
147
- */
148
- export function isDecode<T>(input: Uint8Array): Resolved<T> | null;
149
-
150
- /** @internal */
151
- export function isDecode(): never {
152
- NoTransformConfigurationError("protobuf.isDecode");
153
- }
154
-
155
- /**
156
- * Decodes Protocol Buffer binary with validation.
157
- *
158
- * @danger You must configure the generic argument `T`
159
- */
160
- export function validateDecode(input: Uint8Array): never;
161
-
162
- /**
163
- * Decodes Protocol Buffer binary with validation (partial safety).
164
- *
165
- * Combines {@link decode} with {@link validate}. Returns
166
- * {@link IValidation.IFailure} with errors on mismatch, or
167
- * {@link IValidation.ISuccess} with decoded value.
168
- *
169
- * Warning: Only validates custom tags (e.g., `number & Minimum<7>`, `string &
170
- * Format<"uuid">`), not structural type correctness. Ensure source data was
171
- * encoded with type-safe encoders.
172
- *
173
- * Related functions:
174
- *
175
- * - {@link decode} — No validation
176
- * - {@link assertDecode} — Throws on first error
177
- * - {@link isDecode} — Returns `null` instead of error details
178
- *
179
- * @template T Target type
180
- * @param input Protocol Buffer binary data
181
- * @returns Validation result containing decoded value or errors
182
- */
183
- export function validateDecode<T>(input: Uint8Array): IValidation<Resolved<T>>;
184
-
185
- /** @internal */
186
- export function validateDecode(): never {
187
- NoTransformConfigurationError("protobuf.validateDecode");
188
- }
189
-
190
- /* -----------------------------------------------------------
191
- ENCODE
192
- ----------------------------------------------------------- */
193
- /**
194
- * Encodes value to Protocol Buffer binary.
195
- *
196
- * Converts a TypeScript value to Protocol Buffer binary format.
197
- *
198
- * Does not validate the input. For validation, use:
199
- *
200
- * - {@link assertEncode} — Throws on type mismatch
201
- * - {@link isEncode} — Returns `null` on type mismatch
202
- * - {@link validateEncode} — Returns detailed validation errors
203
- *
204
- * Protocol Buffer has limited expressiveness compared to TypeScript.
205
- * Incompatible types cause compilation errors.
206
- *
207
- * @template T Type of input value
208
- * @param input Value to encode
209
- * @returns Protocol Buffer binary data
210
- * @see https://typia.io/docs/protobuf/message/#restrictions
211
- */
212
- export function encode<T>(input: T): Uint8Array;
213
-
214
- /** @internal */
215
- export function encode(): never {
216
- NoTransformConfigurationError("protobuf.encode");
217
- }
218
-
219
- /**
220
- * Encodes value to Protocol Buffer binary with assertion.
221
- *
222
- * Combines {@link assert} with {@link encode}. Throws {@link TypeGuardError} on
223
- * type mismatch.
224
- *
225
- * Related functions:
226
- *
227
- * - {@link encode} — No validation
228
- * - {@link isEncode} — Returns `null` instead of throwing
229
- * - {@link validateEncode} — Returns detailed validation errors
230
- *
231
- * Protocol Buffer has limited expressiveness compared to TypeScript.
232
- * Incompatible types cause compilation errors.
233
- *
234
- * @template T Type of input value
235
- * @param input Value to encode
236
- * @param errorFactory Custom error factory receiving
237
- * {@link TypeGuardError.IProps}
238
- * @returns Protocol Buffer binary data
239
- * @throws {TypeGuardError} When input doesn't conform to type `T`
240
- * @see https://typia.io/docs/protobuf/message/#restrictions
241
- */
242
- export function assertEncode<T>(
243
- input: T,
244
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
245
- ): Uint8Array;
246
-
247
- /** @internal */
248
- export function assertEncode<T>(
249
- input: unknown,
250
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
251
- ): Uint8Array;
252
-
253
- /** @internal */
254
- export function assertEncode(): never {
255
- NoTransformConfigurationError("protobuf.assertEncode");
256
- }
257
-
258
- /**
259
- * Encodes value to Protocol Buffer binary with type checking.
260
- *
261
- * Combines {@link is} with {@link encode}. Returns `null` on type mismatch.
262
- *
263
- * Related functions:
264
- *
265
- * - {@link encode} — No validation
266
- * - {@link assertEncode} — Throws instead of returning `null`
267
- * - {@link validateEncode} — Returns detailed validation errors
268
- *
269
- * Protocol Buffer has limited expressiveness compared to TypeScript.
270
- * Incompatible types cause compilation errors.
271
- *
272
- * @template T Type of input value
273
- * @param input Value to encode
274
- * @returns Protocol Buffer binary data, or `null` if invalid
275
- * @see https://typia.io/docs/protobuf/message/#restrictions
276
- */
277
- export function isEncode<T>(input: T): Uint8Array | null;
278
-
279
- /** @internal */
280
- export function isEncode<T>(input: unknown): Uint8Array | null;
281
-
282
- /** @internal */
283
- export function isEncode(): never {
284
- NoTransformConfigurationError("protobuf.isEncode");
285
- }
286
-
287
- /**
288
- * Encodes value to Protocol Buffer binary with validation.
289
- *
290
- * Combines {@link validate} with {@link encode}. Returns
291
- * {@link IValidation.IFailure} with all errors on mismatch, or
292
- * {@link IValidation.ISuccess} with binary data.
293
- *
294
- * Related functions:
295
- *
296
- * - {@link encode} — No validation
297
- * - {@link assertEncode} — Throws on first error
298
- * - {@link isEncode} — Returns `null` instead of error details
299
- *
300
- * Protocol Buffer has limited expressiveness compared to TypeScript.
301
- * Incompatible types cause compilation errors.
302
- *
303
- * @template T Type of input value
304
- * @param input Value to encode
305
- * @returns Validation result containing binary data or errors
306
- * @see https://typia.io/docs/protobuf/message/#restrictions
307
- */
308
- export function validateEncode<T>(input: T): IValidation<Uint8Array>;
309
-
310
- /** @internal */
311
- export function validateEncode<T>(input: unknown): IValidation<Uint8Array>;
312
-
313
- /** @internal */
314
- export function validateEncode(): never {
315
- NoTransformConfigurationError("protobuf.validateEncode");
316
- }
317
-
318
- /* -----------------------------------------------------------
319
- FACTORY FUNCTIONS
320
- ----------------------------------------------------------- */
321
- /**
322
- * Creates reusable {@link decode} function.
323
- *
324
- * @danger You must configure the generic argument `T`
325
- */
326
- export function createDecode(): never;
327
-
328
- /**
329
- * Creates reusable {@link decode} function.
330
- *
331
- * @template T Target type
332
- * @returns Reusable decoder function
333
- */
334
- export function createDecode<T>(): (input: Uint8Array) => Resolved<T>;
335
-
336
- /** @internal */
337
- export function createDecode<T>(): (input: Uint8Array) => Resolved<T> {
338
- NoTransformConfigurationError("protobuf.createDecode");
339
- }
340
-
341
- /**
342
- * Creates reusable {@link isDecode} function.
343
- *
344
- * @danger You must configure the generic argument `T`
345
- */
346
- export function createIsDecode(): never;
347
-
348
- /**
349
- * Creates reusable {@link isDecode} function.
350
- *
351
- * @template T Target type
352
- * @returns Reusable decoder function
353
- */
354
- export function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null;
355
-
356
- /** @internal */
357
- export function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null {
358
- NoTransformConfigurationError("protobuf.createIsDecode");
359
- }
360
-
361
- /**
362
- * Creates reusable {@link assertDecode} function.
363
- *
364
- * @danger You must configure the generic argument `T`
365
- */
366
- export function createAssertDecode(
367
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
368
- ): never;
369
-
370
- /**
371
- * Creates reusable {@link assertDecode} function.
372
- *
373
- * @template T Target type
374
- * @param errorFactory Custom error factory receiving
375
- * {@link TypeGuardError.IProps}
376
- * @returns Reusable decoder function
377
- */
378
- export function createAssertDecode<T>(
379
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
380
- ): (input: Uint8Array) => Resolved<T>;
381
-
382
- /** @internal */
383
- export function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T> {
384
- NoTransformConfigurationError("protobuf.createAssertDecode");
385
- }
386
-
387
- /**
388
- * Creates reusable {@link validateDecode} function.
389
- *
390
- * @danger You must configure the generic argument `T`
391
- */
392
- export function createValidateDecode(): never;
393
-
394
- /**
395
- * Creates reusable {@link validateDecode} function.
396
- *
397
- * @template T Target type
398
- * @returns Reusable decoder function
399
- */
400
- export function createValidateDecode<T>(): (
401
- input: Uint8Array,
402
- ) => IValidation<Resolved<T>>;
403
-
404
- /** @internal */
405
- export function createValidateDecode<T>(): (
406
- input: Uint8Array,
407
- ) => IValidation<Resolved<T>> {
408
- NoTransformConfigurationError("protobuf.createValidateDecode");
409
- }
410
-
411
- /**
412
- * Creates reusable {@link encode} function.
413
- *
414
- * @danger You must configure the generic argument `T`
415
- */
416
- export function createEncode(): never;
417
-
418
- /**
419
- * Creates reusable {@link encode} function.
420
- *
421
- * @template T Type of input value
422
- * @returns Reusable encoder function
423
- */
424
- export function createEncode<T>(): (input: T) => Uint8Array;
425
-
426
- /** @internal */
427
- export function createEncode<T>(): (input: T) => Uint8Array {
428
- NoTransformConfigurationError("protobuf.createEncode");
429
- }
430
-
431
- /**
432
- * Creates reusable {@link isEncode} function.
433
- *
434
- * @danger You must configure the generic argument `T`
435
- */
436
- export function createIsEncode(): never;
437
-
438
- /**
439
- * Creates reusable {@link isEncode} function.
440
- *
441
- * @template T Type of input value
442
- * @returns Reusable encoder function
443
- */
444
- export function createIsEncode<T>(): (input: T) => Uint8Array | null;
445
-
446
- /** @internal */
447
- export function createIsEncode<T>(): (input: T) => Uint8Array | null {
448
- NoTransformConfigurationError("protobuf.createIsEncode");
449
- }
450
-
451
- /**
452
- * Creates reusable {@link assertEncode} function.
453
- *
454
- * @danger You must configure the generic argument `T`
455
- */
456
- export function createAssertEncode(
457
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
458
- ): never;
459
-
460
- /**
461
- * Creates reusable {@link assertEncode} function.
462
- *
463
- * @template T Type of input value
464
- * @param errorFactory Custom error factory receiving
465
- * {@link TypeGuardError.IProps}
466
- * @returns Reusable encoder function
467
- */
468
- export function createAssertEncode<T>(
469
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
470
- ): (input: T) => Uint8Array;
471
-
472
- /** @internal */
473
- export function createAssertEncode<T>(): (input: T) => Uint8Array {
474
- NoTransformConfigurationError("protobuf.createAssertEncode");
475
- }
476
-
477
- /**
478
- * Creates reusable {@link validateEncode} function.
479
- *
480
- * @danger You must configure the generic argument `T`
481
- */
482
- export function createValidateEncode(): never;
483
-
484
- /**
485
- * Creates reusable {@link validateEncode} function.
486
- *
487
- * @template T Type of input value
488
- * @returns Reusable encoder function
489
- */
490
- export function createValidateEncode<T>(): (
491
- input: T,
492
- ) => IValidation<Uint8Array>;
493
-
494
- /** @internal */
495
- export function createValidateEncode<T>(): (
496
- input: T,
497
- ) => IValidation<Uint8Array> {
498
- NoTransformConfigurationError("protobuf.createValidateEncode");
499
- }
1
+ import { IValidation, Resolved } from "@typia/interface";
2
+
3
+ import { TypeGuardError } from "./TypeGuardError";
4
+ import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
5
+
6
+ /* ===========================================================
7
+ PROTOCOL BUFFER
8
+ - MESSAGE
9
+ - DECODE
10
+ - ENCODE
11
+ - FACTORY FUNCTIONS
12
+ ==============================================================
13
+ SCHEMA
14
+ ----------------------------------------------------------- */
15
+ /**
16
+ * Generates Protocol Buffer message schema.
17
+ *
18
+ * @danger You must configure the generic argument `T`
19
+ */
20
+ export function message(): never;
21
+
22
+ /**
23
+ * Generates Protocol Buffer message schema for type `T`.
24
+ *
25
+ * Creates a `.proto` message definition string from a TypeScript type. Use for
26
+ * sharing schemas with other languages/frameworks.
27
+ *
28
+ * Protocol Buffer has limited expressiveness compared to TypeScript.
29
+ * Incompatible types cause compilation errors.
30
+ *
31
+ * @template T Target type
32
+ * @returns Protocol Buffer message schema string
33
+ * @see https://typia.io/docs/protobuf/message/#restrictions
34
+ */
35
+ export function message<T>(): string;
36
+
37
+ /** @internal */
38
+ export function message(): never {
39
+ NoTransformConfigurationError("protobuf.message");
40
+ }
41
+
42
+ /* -----------------------------------------------------------
43
+ DECODE
44
+ ----------------------------------------------------------- */
45
+ /**
46
+ * Decodes Protocol Buffer binary.
47
+ *
48
+ * @danger You must configure the generic argument `T`
49
+ */
50
+ export function decode(input: Uint8Array): never;
51
+
52
+ /**
53
+ * Decodes Protocol Buffer binary to type `T`.
54
+ *
55
+ * Converts Protocol Buffer binary data to a TypeScript instance. Binary data
56
+ * must have been encoded from a `T`-typed value—invalid data causes undefined
57
+ * behavior or errors.
58
+ *
59
+ * For type safety, ensure data was encoded via:
60
+ *
61
+ * - {@link assertEncode} — Encodes with type assertion
62
+ * - {@link isEncode} — Encodes with type checking
63
+ * - {@link validateEncode} — Encodes with validation
64
+ *
65
+ * Note: Decoder validation ({@link assertDecode}, etc.) only checks custom tags
66
+ * like `number & Minimum<7>`, not structural type safety.
67
+ *
68
+ * @template T Target type
69
+ * @param input Protocol Buffer binary data
70
+ * @returns Decoded value of type `T`
71
+ */
72
+ export function decode<T>(input: Uint8Array): Resolved<T>;
73
+
74
+ /** @internal */
75
+ export function decode(): never {
76
+ NoTransformConfigurationError("protobuf.decode");
77
+ }
78
+
79
+ /**
80
+ * Decodes Protocol Buffer binary with assertion.
81
+ *
82
+ * @danger You must configure the generic argument `T`
83
+ */
84
+ export function assertDecode(
85
+ input: Uint8Array,
86
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
87
+ ): never;
88
+
89
+ /**
90
+ * Decodes Protocol Buffer binary with assertion (partial safety).
91
+ *
92
+ * Combines {@link decode} with {@link assert}. Throws {@link TypeGuardError} on
93
+ * validation failure.
94
+ *
95
+ * Warning: Only validates custom tags (e.g., `number & Minimum<7>`, `string &
96
+ * Format<"uuid">`), not structural type correctness. Ensure source data was
97
+ * encoded with type-safe encoders.
98
+ *
99
+ * Related functions:
100
+ *
101
+ * - {@link decode} — No validation
102
+ * - {@link isDecode} — Returns `null` instead of throwing
103
+ * - {@link validateDecode} — Returns detailed validation errors
104
+ *
105
+ * @template T Target type
106
+ * @param input Protocol Buffer binary data
107
+ * @param errorFactory Custom error factory receiving
108
+ * {@link TypeGuardError.IProps}
109
+ * @returns Decoded value of type `T`
110
+ * @throws {TypeGuardError} When custom tag validation fails
111
+ */
112
+ export function assertDecode<T>(
113
+ input: Uint8Array,
114
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
115
+ ): Resolved<T>;
116
+
117
+ /** @internal */
118
+ export function assertDecode(): never {
119
+ NoTransformConfigurationError("protobuf.assertDecode");
120
+ }
121
+
122
+ /**
123
+ * Decodes Protocol Buffer binary with type checking.
124
+ *
125
+ * @danger You must configure the generic argument `T`
126
+ */
127
+ export function isDecode(input: Uint8Array): never;
128
+
129
+ /**
130
+ * Decodes Protocol Buffer binary with type checking (partial safety).
131
+ *
132
+ * Combines {@link decode} with {@link is}. Returns `null` on validation failure.
133
+ *
134
+ * Warning: Only validates custom tags (e.g., `number & Minimum<7>`, `string &
135
+ * Format<"uuid">`), not structural type correctness. Ensure source data was
136
+ * encoded with type-safe encoders.
137
+ *
138
+ * Related functions:
139
+ *
140
+ * - {@link decode} — No validation
141
+ * - {@link assertDecode} — Throws instead of returning `null`
142
+ * - {@link validateDecode} — Returns detailed validation errors
143
+ *
144
+ * @template T Target type
145
+ * @param input Protocol Buffer binary data
146
+ * @returns Decoded value of type `T`, or `null` if invalid
147
+ */
148
+ export function isDecode<T>(input: Uint8Array): Resolved<T> | null;
149
+
150
+ /** @internal */
151
+ export function isDecode(): never {
152
+ NoTransformConfigurationError("protobuf.isDecode");
153
+ }
154
+
155
+ /**
156
+ * Decodes Protocol Buffer binary with validation.
157
+ *
158
+ * @danger You must configure the generic argument `T`
159
+ */
160
+ export function validateDecode(input: Uint8Array): never;
161
+
162
+ /**
163
+ * Decodes Protocol Buffer binary with validation (partial safety).
164
+ *
165
+ * Combines {@link decode} with {@link validate}. Returns
166
+ * {@link IValidation.IFailure} with errors on mismatch, or
167
+ * {@link IValidation.ISuccess} with decoded value.
168
+ *
169
+ * Warning: Only validates custom tags (e.g., `number & Minimum<7>`, `string &
170
+ * Format<"uuid">`), not structural type correctness. Ensure source data was
171
+ * encoded with type-safe encoders.
172
+ *
173
+ * Related functions:
174
+ *
175
+ * - {@link decode} — No validation
176
+ * - {@link assertDecode} — Throws on first error
177
+ * - {@link isDecode} — Returns `null` instead of error details
178
+ *
179
+ * @template T Target type
180
+ * @param input Protocol Buffer binary data
181
+ * @returns Validation result containing decoded value or errors
182
+ */
183
+ export function validateDecode<T>(input: Uint8Array): IValidation<Resolved<T>>;
184
+
185
+ /** @internal */
186
+ export function validateDecode(): never {
187
+ NoTransformConfigurationError("protobuf.validateDecode");
188
+ }
189
+
190
+ /* -----------------------------------------------------------
191
+ ENCODE
192
+ ----------------------------------------------------------- */
193
+ /**
194
+ * Encodes value to Protocol Buffer binary.
195
+ *
196
+ * Converts a TypeScript value to Protocol Buffer binary format.
197
+ *
198
+ * Does not validate the input. For validation, use:
199
+ *
200
+ * - {@link assertEncode} — Throws on type mismatch
201
+ * - {@link isEncode} — Returns `null` on type mismatch
202
+ * - {@link validateEncode} — Returns detailed validation errors
203
+ *
204
+ * Protocol Buffer has limited expressiveness compared to TypeScript.
205
+ * Incompatible types cause compilation errors.
206
+ *
207
+ * @template T Type of input value
208
+ * @param input Value to encode
209
+ * @returns Protocol Buffer binary data
210
+ * @see https://typia.io/docs/protobuf/message/#restrictions
211
+ */
212
+ export function encode<T>(input: T): Uint8Array;
213
+
214
+ /** @internal */
215
+ export function encode(): never {
216
+ NoTransformConfigurationError("protobuf.encode");
217
+ }
218
+
219
+ /**
220
+ * Encodes value to Protocol Buffer binary with assertion.
221
+ *
222
+ * Combines {@link assert} with {@link encode}. Throws {@link TypeGuardError} on
223
+ * type mismatch.
224
+ *
225
+ * Related functions:
226
+ *
227
+ * - {@link encode} — No validation
228
+ * - {@link isEncode} — Returns `null` instead of throwing
229
+ * - {@link validateEncode} — Returns detailed validation errors
230
+ *
231
+ * Protocol Buffer has limited expressiveness compared to TypeScript.
232
+ * Incompatible types cause compilation errors.
233
+ *
234
+ * @template T Type of input value
235
+ * @param input Value to encode
236
+ * @param errorFactory Custom error factory receiving
237
+ * {@link TypeGuardError.IProps}
238
+ * @returns Protocol Buffer binary data
239
+ * @throws {TypeGuardError} When input doesn't conform to type `T`
240
+ * @see https://typia.io/docs/protobuf/message/#restrictions
241
+ */
242
+ export function assertEncode<T>(
243
+ input: T,
244
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
245
+ ): Uint8Array;
246
+
247
+ /** @internal */
248
+ export function assertEncode<T>(
249
+ input: unknown,
250
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
251
+ ): Uint8Array;
252
+
253
+ /** @internal */
254
+ export function assertEncode(): never {
255
+ NoTransformConfigurationError("protobuf.assertEncode");
256
+ }
257
+
258
+ /**
259
+ * Encodes value to Protocol Buffer binary with type checking.
260
+ *
261
+ * Combines {@link is} with {@link encode}. Returns `null` on type mismatch.
262
+ *
263
+ * Related functions:
264
+ *
265
+ * - {@link encode} — No validation
266
+ * - {@link assertEncode} — Throws instead of returning `null`
267
+ * - {@link validateEncode} — Returns detailed validation errors
268
+ *
269
+ * Protocol Buffer has limited expressiveness compared to TypeScript.
270
+ * Incompatible types cause compilation errors.
271
+ *
272
+ * @template T Type of input value
273
+ * @param input Value to encode
274
+ * @returns Protocol Buffer binary data, or `null` if invalid
275
+ * @see https://typia.io/docs/protobuf/message/#restrictions
276
+ */
277
+ export function isEncode<T>(input: T): Uint8Array | null;
278
+
279
+ /** @internal */
280
+ export function isEncode<T>(input: unknown): Uint8Array | null;
281
+
282
+ /** @internal */
283
+ export function isEncode(): never {
284
+ NoTransformConfigurationError("protobuf.isEncode");
285
+ }
286
+
287
+ /**
288
+ * Encodes value to Protocol Buffer binary with validation.
289
+ *
290
+ * Combines {@link validate} with {@link encode}. Returns
291
+ * {@link IValidation.IFailure} with all errors on mismatch, or
292
+ * {@link IValidation.ISuccess} with binary data.
293
+ *
294
+ * Related functions:
295
+ *
296
+ * - {@link encode} — No validation
297
+ * - {@link assertEncode} — Throws on first error
298
+ * - {@link isEncode} — Returns `null` instead of error details
299
+ *
300
+ * Protocol Buffer has limited expressiveness compared to TypeScript.
301
+ * Incompatible types cause compilation errors.
302
+ *
303
+ * @template T Type of input value
304
+ * @param input Value to encode
305
+ * @returns Validation result containing binary data or errors
306
+ * @see https://typia.io/docs/protobuf/message/#restrictions
307
+ */
308
+ export function validateEncode<T>(input: T): IValidation<Uint8Array>;
309
+
310
+ /** @internal */
311
+ export function validateEncode<T>(input: unknown): IValidation<Uint8Array>;
312
+
313
+ /** @internal */
314
+ export function validateEncode(): never {
315
+ NoTransformConfigurationError("protobuf.validateEncode");
316
+ }
317
+
318
+ /* -----------------------------------------------------------
319
+ FACTORY FUNCTIONS
320
+ ----------------------------------------------------------- */
321
+ /**
322
+ * Creates reusable {@link decode} function.
323
+ *
324
+ * @danger You must configure the generic argument `T`
325
+ */
326
+ export function createDecode(): never;
327
+
328
+ /**
329
+ * Creates reusable {@link decode} function.
330
+ *
331
+ * @template T Target type
332
+ * @returns Reusable decoder function
333
+ */
334
+ export function createDecode<T>(): (input: Uint8Array) => Resolved<T>;
335
+
336
+ /** @internal */
337
+ export function createDecode<T>(): (input: Uint8Array) => Resolved<T> {
338
+ NoTransformConfigurationError("protobuf.createDecode");
339
+ }
340
+
341
+ /**
342
+ * Creates reusable {@link isDecode} function.
343
+ *
344
+ * @danger You must configure the generic argument `T`
345
+ */
346
+ export function createIsDecode(): never;
347
+
348
+ /**
349
+ * Creates reusable {@link isDecode} function.
350
+ *
351
+ * @template T Target type
352
+ * @returns Reusable decoder function
353
+ */
354
+ export function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null;
355
+
356
+ /** @internal */
357
+ export function createIsDecode<T>(): (input: Uint8Array) => Resolved<T> | null {
358
+ NoTransformConfigurationError("protobuf.createIsDecode");
359
+ }
360
+
361
+ /**
362
+ * Creates reusable {@link assertDecode} function.
363
+ *
364
+ * @danger You must configure the generic argument `T`
365
+ */
366
+ export function createAssertDecode(
367
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
368
+ ): never;
369
+
370
+ /**
371
+ * Creates reusable {@link assertDecode} function.
372
+ *
373
+ * @template T Target type
374
+ * @param errorFactory Custom error factory receiving
375
+ * {@link TypeGuardError.IProps}
376
+ * @returns Reusable decoder function
377
+ */
378
+ export function createAssertDecode<T>(
379
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
380
+ ): (input: Uint8Array) => Resolved<T>;
381
+
382
+ /** @internal */
383
+ export function createAssertDecode<T>(): (input: Uint8Array) => Resolved<T> {
384
+ NoTransformConfigurationError("protobuf.createAssertDecode");
385
+ }
386
+
387
+ /**
388
+ * Creates reusable {@link validateDecode} function.
389
+ *
390
+ * @danger You must configure the generic argument `T`
391
+ */
392
+ export function createValidateDecode(): never;
393
+
394
+ /**
395
+ * Creates reusable {@link validateDecode} function.
396
+ *
397
+ * @template T Target type
398
+ * @returns Reusable decoder function
399
+ */
400
+ export function createValidateDecode<T>(): (
401
+ input: Uint8Array,
402
+ ) => IValidation<Resolved<T>>;
403
+
404
+ /** @internal */
405
+ export function createValidateDecode<T>(): (
406
+ input: Uint8Array,
407
+ ) => IValidation<Resolved<T>> {
408
+ NoTransformConfigurationError("protobuf.createValidateDecode");
409
+ }
410
+
411
+ /**
412
+ * Creates reusable {@link encode} function.
413
+ *
414
+ * @danger You must configure the generic argument `T`
415
+ */
416
+ export function createEncode(): never;
417
+
418
+ /**
419
+ * Creates reusable {@link encode} function.
420
+ *
421
+ * @template T Type of input value
422
+ * @returns Reusable encoder function
423
+ */
424
+ export function createEncode<T>(): (input: T) => Uint8Array;
425
+
426
+ /** @internal */
427
+ export function createEncode<T>(): (input: T) => Uint8Array {
428
+ NoTransformConfigurationError("protobuf.createEncode");
429
+ }
430
+
431
+ /**
432
+ * Creates reusable {@link isEncode} function.
433
+ *
434
+ * @danger You must configure the generic argument `T`
435
+ */
436
+ export function createIsEncode(): never;
437
+
438
+ /**
439
+ * Creates reusable {@link isEncode} function.
440
+ *
441
+ * @template T Type of input value
442
+ * @returns Reusable encoder function
443
+ */
444
+ export function createIsEncode<T>(): (input: T) => Uint8Array | null;
445
+
446
+ /** @internal */
447
+ export function createIsEncode<T>(): (input: T) => Uint8Array | null {
448
+ NoTransformConfigurationError("protobuf.createIsEncode");
449
+ }
450
+
451
+ /**
452
+ * Creates reusable {@link assertEncode} function.
453
+ *
454
+ * @danger You must configure the generic argument `T`
455
+ */
456
+ export function createAssertEncode(
457
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
458
+ ): never;
459
+
460
+ /**
461
+ * Creates reusable {@link assertEncode} function.
462
+ *
463
+ * @template T Type of input value
464
+ * @param errorFactory Custom error factory receiving
465
+ * {@link TypeGuardError.IProps}
466
+ * @returns Reusable encoder function
467
+ */
468
+ export function createAssertEncode<T>(
469
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
470
+ ): (input: T) => Uint8Array;
471
+
472
+ /** @internal */
473
+ export function createAssertEncode<T>(): (input: T) => Uint8Array {
474
+ NoTransformConfigurationError("protobuf.createAssertEncode");
475
+ }
476
+
477
+ /**
478
+ * Creates reusable {@link validateEncode} function.
479
+ *
480
+ * @danger You must configure the generic argument `T`
481
+ */
482
+ export function createValidateEncode(): never;
483
+
484
+ /**
485
+ * Creates reusable {@link validateEncode} function.
486
+ *
487
+ * @template T Type of input value
488
+ * @returns Reusable encoder function
489
+ */
490
+ export function createValidateEncode<T>(): (
491
+ input: T,
492
+ ) => IValidation<Uint8Array>;
493
+
494
+ /** @internal */
495
+ export function createValidateEncode<T>(): (
496
+ input: T,
497
+ ) => IValidation<Uint8Array> {
498
+ NoTransformConfigurationError("protobuf.createValidateEncode");
499
+ }