typia 5.3.11 → 6.0.0-dev.20240118

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 (180) hide show
  1. package/lib/IRandomGenerator.d.ts +1 -0
  2. package/lib/functional/$HeadersReader.d.ts +1 -6
  3. package/lib/functional/$HeadersReader.js.map +1 -1
  4. package/lib/functional/$ParameterReader.d.ts +1 -6
  5. package/lib/functional/$ParameterReader.js.map +1 -1
  6. package/lib/functional/$ProtobufReader.d.ts +1 -35
  7. package/lib/functional/$ProtobufReader.js.map +1 -1
  8. package/lib/functional/$ProtobufSizer.d.ts +1 -36
  9. package/lib/functional/$ProtobufSizer.js.map +1 -1
  10. package/lib/functional/$ProtobufWriter.d.ts +1 -45
  11. package/lib/functional/$ProtobufWriter.js.map +1 -1
  12. package/lib/functional/$QueryReader.d.ts +1 -8
  13. package/lib/functional/$QueryReader.js.map +1 -1
  14. package/lib/functional/$camel.js +7 -0
  15. package/lib/functional/$camel.js.map +1 -0
  16. package/lib/functional/$clone.d.ts +1 -2
  17. package/lib/functional/$clone.js +1 -1
  18. package/lib/functional/$clone.js.map +1 -1
  19. package/lib/functional/$convention.d.ts +1 -1
  20. package/lib/functional/$convention.js.map +1 -1
  21. package/lib/functional/$generator.d.ts +1 -0
  22. package/lib/functional/$generator.js +6 -0
  23. package/lib/functional/$generator.js.map +1 -0
  24. package/lib/functional/$is_between.d.ts +1 -1
  25. package/lib/functional/$is_between.js.map +1 -1
  26. package/lib/functional/$join.d.ts +1 -1
  27. package/lib/functional/$join.js.map +1 -1
  28. package/lib/functional/$number.d.ts +1 -1
  29. package/lib/functional/$number.js.map +1 -1
  30. package/lib/functional/$pascal.d.ts +1 -0
  31. package/lib/functional/$pascal.js +7 -0
  32. package/lib/functional/$pascal.js.map +1 -0
  33. package/lib/functional/$report.d.ts +1 -2
  34. package/lib/functional/$report.js.map +1 -1
  35. package/lib/functional/$rest.d.ts +1 -1
  36. package/lib/functional/$rest.js.map +1 -1
  37. package/lib/functional/$snake.d.ts +1 -0
  38. package/lib/functional/$snake.js +7 -0
  39. package/lib/functional/$snake.js.map +1 -0
  40. package/lib/functional/$stoll.d.ts +1 -1
  41. package/lib/functional/$stoll.js.map +1 -1
  42. package/lib/functional/$strlen.d.ts +1 -1
  43. package/lib/functional/$strlen.js.map +1 -1
  44. package/lib/functional/$throws.d.ts +1 -0
  45. package/lib/functional/$throws.js +22 -0
  46. package/lib/functional/$throws.js.map +1 -0
  47. package/lib/functional/IProtobufWriter.d.ts +1 -15
  48. package/lib/http.js +0 -33
  49. package/lib/http.js.map +1 -1
  50. package/lib/json.js +0 -18
  51. package/lib/json.js.map +1 -1
  52. package/lib/misc.js +0 -23
  53. package/lib/misc.js.map +1 -1
  54. package/lib/module.js +0 -19
  55. package/lib/module.js.map +1 -1
  56. package/lib/notations.js +0 -43
  57. package/lib/notations.js.map +1 -1
  58. package/lib/programmers/AssertProgrammer.js +4 -4
  59. package/lib/programmers/AssertProgrammer.js.map +1 -1
  60. package/lib/programmers/CheckerProgrammer.d.ts +1 -1
  61. package/lib/programmers/FeatureProgrammer.d.ts +1 -1
  62. package/lib/programmers/IsProgrammer.d.ts +1 -1
  63. package/lib/programmers/IsProgrammer.js +4 -4
  64. package/lib/programmers/IsProgrammer.js.map +1 -1
  65. package/lib/programmers/RandomProgrammer.js +4 -4
  66. package/lib/programmers/RandomProgrammer.js.map +1 -1
  67. package/lib/programmers/ValidateProgrammer.js +6 -4
  68. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  69. package/lib/programmers/helpers/{FunctionImporeter.d.ts → FunctionImporter.d.ts} +2 -2
  70. package/lib/programmers/helpers/{FunctionImporeter.js → FunctionImporter.js} +15 -8
  71. package/lib/programmers/helpers/FunctionImporter.js.map +1 -0
  72. package/lib/programmers/helpers/StringifyJoinder.d.ts +1 -1
  73. package/lib/programmers/helpers/StringifyJoinder.js +1 -1
  74. package/lib/programmers/helpers/StringifyJoinder.js.map +1 -1
  75. package/lib/programmers/helpers/disable_function_importer_declare.d.ts +1 -1
  76. package/lib/programmers/helpers/disable_function_importer_declare.js +4 -2
  77. package/lib/programmers/helpers/disable_function_importer_declare.js.map +1 -1
  78. package/lib/programmers/http/HttpHeadersProgrammer.js +9 -6
  79. package/lib/programmers/http/HttpHeadersProgrammer.js.map +1 -1
  80. package/lib/programmers/http/HttpParameterProgrammer.js +4 -6
  81. package/lib/programmers/http/HttpParameterProgrammer.js.map +1 -1
  82. package/lib/programmers/http/HttpQueryProgrammer.js +6 -6
  83. package/lib/programmers/http/HttpQueryProgrammer.js.map +1 -1
  84. package/lib/programmers/internal/check_dynamic_key.d.ts +1 -1
  85. package/lib/programmers/json/JsonStringifyProgrammer.js +4 -4
  86. package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
  87. package/lib/programmers/misc/MiscCloneProgrammer.js +5 -7
  88. package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
  89. package/lib/programmers/misc/MiscPruneProgrammer.js +3 -3
  90. package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
  91. package/lib/programmers/notations/NotationGeneralProgrammer.js +177 -169
  92. package/lib/programmers/notations/NotationGeneralProgrammer.js.map +1 -1
  93. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +4 -6
  94. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
  95. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +6 -8
  96. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
  97. package/lib/protobuf.js +0 -29
  98. package/lib/protobuf.js.map +1 -1
  99. package/lib/schemas/metadata/MetadataObject.js +1 -2
  100. package/lib/schemas/metadata/MetadataObject.js.map +1 -1
  101. package/package.json +1 -1
  102. package/src/IRandomGenerator.ts +2 -0
  103. package/src/functional/$HeadersReader.ts +9 -0
  104. package/src/functional/$ParameterReader.ts +9 -0
  105. package/src/functional/$ProtobufReader.ts +15 -1
  106. package/src/functional/$ProtobufSizer.ts +11 -1
  107. package/src/functional/$ProtobufWriter.ts +26 -1
  108. package/src/functional/$QueryReader.ts +9 -0
  109. package/src/functional/$camel.ts +8 -0
  110. package/src/functional/$clone.ts +4 -1
  111. package/src/functional/$convention.ts +3 -0
  112. package/src/functional/$generator.ts +6 -0
  113. package/src/functional/$is_between.ts +3 -0
  114. package/src/functional/$join.ts +12 -0
  115. package/src/functional/$number.ts +3 -0
  116. package/src/functional/$pascal.ts +8 -0
  117. package/src/functional/$report.ts +3 -0
  118. package/src/functional/$rest.ts +3 -0
  119. package/src/functional/$snake.ts +8 -0
  120. package/src/functional/$stoll.ts +3 -0
  121. package/src/functional/$string.ts +1 -1
  122. package/src/functional/$strlen.ts +3 -0
  123. package/src/functional/$throws.ts +13 -0
  124. package/src/functional/IProtobufWriter.ts +3 -0
  125. package/src/http.ts +0 -37
  126. package/src/json.ts +0 -20
  127. package/src/misc.ts +0 -24
  128. package/src/module.ts +0 -20
  129. package/src/notations.ts +0 -71
  130. package/src/programmers/AssertProgrammer.ts +3 -3
  131. package/src/programmers/CheckerProgrammer.ts +1 -1
  132. package/src/programmers/FeatureProgrammer.ts +1 -1
  133. package/src/programmers/IsProgrammer.ts +2 -2
  134. package/src/programmers/RandomProgrammer.ts +3 -3
  135. package/src/programmers/ValidateProgrammer.ts +11 -8
  136. package/src/programmers/helpers/{FunctionImporeter.ts → FunctionImporter.ts} +21 -18
  137. package/src/programmers/helpers/StringifyJoinder.ts +3 -4
  138. package/src/programmers/helpers/disable_function_importer_declare.ts +4 -3
  139. package/src/programmers/http/HttpHeadersProgrammer.ts +8 -8
  140. package/src/programmers/http/HttpParameterProgrammer.ts +7 -5
  141. package/src/programmers/http/HttpQueryProgrammer.ts +14 -13
  142. package/src/programmers/internal/check_dynamic_key.ts +1 -1
  143. package/src/programmers/internal/check_dynamic_properties.ts +1 -1
  144. package/src/programmers/internal/check_object.ts +1 -1
  145. package/src/programmers/internal/feature_object_entries.ts +1 -1
  146. package/src/programmers/json/JsonStringifyProgrammer.ts +3 -3
  147. package/src/programmers/misc/MiscCloneProgrammer.ts +8 -6
  148. package/src/programmers/misc/MiscPruneProgrammer.ts +2 -2
  149. package/src/programmers/notations/NotationGeneralProgrammer.ts +24 -13
  150. package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +7 -5
  151. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +13 -10
  152. package/src/protobuf.ts +0 -48
  153. package/src/schemas/metadata/IMetadataConstant.ts +0 -7
  154. package/src/schemas/metadata/IMetadataObject.ts +0 -5
  155. package/src/schemas/metadata/MetadataObject.ts +1 -2
  156. package/lib/functional/$any.d.ts +0 -1
  157. package/lib/functional/$any.js +0 -9
  158. package/lib/functional/$any.js.map +0 -1
  159. package/lib/functional/$dictionary.d.ts +0 -2
  160. package/lib/functional/$dictionary.js +0 -15
  161. package/lib/functional/$dictionary.js.map +0 -1
  162. package/lib/functional/$every.d.ts +0 -2
  163. package/lib/functional/$every.js +0 -12
  164. package/lib/functional/$every.js.map +0 -1
  165. package/lib/functional/$varint.d.ts +0 -6
  166. package/lib/functional/$varint.js +0 -99
  167. package/lib/functional/$varint.js.map +0 -1
  168. package/lib/functional/$zigzag.d.ts +0 -4
  169. package/lib/functional/$zigzag.js +0 -34
  170. package/lib/functional/$zigzag.js.map +0 -1
  171. package/lib/functional/Namespace.js +0 -104
  172. package/lib/functional/Namespace.js.map +0 -1
  173. package/lib/programmers/helpers/FunctionImporeter.js.map +0 -1
  174. package/src/functional/$any.ts +0 -4
  175. package/src/functional/$dictionary.ts +0 -22
  176. package/src/functional/$every.ts +0 -11
  177. package/src/functional/$varint.ts +0 -130
  178. package/src/functional/$zigzag.ts +0 -39
  179. package/src/functional/Namespace.ts +0 -167
  180. /package/lib/functional/{Namespace.d.ts → $camel.d.ts} +0 -0
package/src/notations.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { Namespace } from "./functional/Namespace";
2
-
3
1
  import { CamelCase } from "./CamelCase";
4
2
  import { IValidation } from "./IValidation";
5
3
  import { PascalCase } from "./PascalCase";
@@ -41,7 +39,6 @@ export function camel<T>(input: T): CamelCase<T>;
41
39
  export function camel(): never {
42
40
  return halt("camel");
43
41
  }
44
- Object.assign(camel, Namespace.notations.camel("camel"));
45
42
 
46
43
  /**
47
44
  * Converts to camel case with type assertion.
@@ -77,8 +74,6 @@ export function assertCamel<T>(input: unknown): CamelCase<T>;
77
74
  export function assertCamel(): never {
78
75
  return halt("assertCamel");
79
76
  }
80
- Object.assign(assertCamel, Namespace.notations.camel("assertCamel"));
81
- Object.assign(assertCamel, Namespace.assert("notations.assertCamel"));
82
77
 
83
78
  /**
84
79
  * Converts to camel case with type checking.
@@ -114,8 +109,6 @@ export function isCamel<T>(input: unknown): CamelCase<T> | null;
114
109
  export function isCamel(): never {
115
110
  return halt("isCamel");
116
111
  }
117
- Object.assign(isCamel, Namespace.notations.camel("isCamel"));
118
- Object.assign(isCamel, Namespace.is());
119
112
 
120
113
  /**
121
114
  * Converts to camel case with type validation.
@@ -155,8 +148,6 @@ export function validateCamel<T>(input: unknown): IValidation<CamelCase<T>>;
155
148
  export function validateCamel(): never {
156
149
  return halt("validateCamel");
157
150
  }
158
- Object.assign(validateCamel, Namespace.notations.camel("validateCamel"));
159
- Object.assign(validateCamel, Namespace.validate());
160
151
 
161
152
  /* -----------------------------------------------------------
162
153
  PASCAL CASE
@@ -188,7 +179,6 @@ export function pascal<T>(input: T): PascalCase<T>;
188
179
  export function pascal(): never {
189
180
  return halt("pascal");
190
181
  }
191
- Object.assign(pascal, Namespace.notations.pascal("pascal"));
192
182
 
193
183
  /**
194
184
  * Converts to pascal case with type assertion.
@@ -224,8 +214,6 @@ export function assertPascal<T>(input: unknown): PascalCase<T>;
224
214
  export function assertPascal(): never {
225
215
  return halt("assertPascal");
226
216
  }
227
- Object.assign(assertPascal, Namespace.notations.pascal("assertPascal"));
228
- Object.assign(assertPascal, Namespace.assert("notations.assertPascal"));
229
217
 
230
218
  /**
231
219
  * Converts to pascal case with type checking.
@@ -261,8 +249,6 @@ export function isPascal<T>(input: unknown): PascalCase<T> | null;
261
249
  export function isPascal(): never {
262
250
  return halt("isPascal");
263
251
  }
264
- Object.assign(isPascal, Namespace.notations.pascal("isPascal"));
265
- Object.assign(isPascal, Namespace.is());
266
252
 
267
253
  /**
268
254
  * Converts to pascal case with type validation.
@@ -302,8 +288,6 @@ export function validatePascal<T>(input: unknown): IValidation<PascalCase<T>>;
302
288
  export function validatePascal(): never {
303
289
  return halt("validatePascal");
304
290
  }
305
- Object.assign(validatePascal, Namespace.notations.pascal("validatePascal"));
306
- Object.assign(validatePascal, Namespace.validate());
307
291
 
308
292
  /* -----------------------------------------------------------
309
293
  SNAKE CASE
@@ -335,7 +319,6 @@ export function snake<T>(input: T): SnakeCase<T>;
335
319
  export function snake(): never {
336
320
  return halt("snake");
337
321
  }
338
- Object.assign(snake, Namespace.notations.snake("snake"));
339
322
 
340
323
  /**
341
324
  * Converts to snake case with type assertion.
@@ -371,8 +354,6 @@ export function assertSnake<T>(input: unknown): SnakeCase<T>;
371
354
  export function assertSnake(): never {
372
355
  return halt("assertSnake");
373
356
  }
374
- Object.assign(assertSnake, Namespace.notations.snake("assertSnake"));
375
- Object.assign(assertSnake, Namespace.assert("notations.assertSnake"));
376
357
 
377
358
  /**
378
359
  * Converts to snake case with type checking.
@@ -408,8 +389,6 @@ export function isSnake<T>(input: unknown): SnakeCase<T> | null;
408
389
  export function isSnake(): never {
409
390
  return halt("isSnake");
410
391
  }
411
- Object.assign(isSnake, Namespace.notations.snake("isSnake"));
412
- Object.assign(isSnake, Namespace.is());
413
392
 
414
393
  /**
415
394
  * Converts to snake case with type validation.
@@ -449,8 +428,6 @@ export function validateSnake<T>(input: unknown): IValidation<SnakeCase<T>>;
449
428
  export function validateSnake(): never {
450
429
  return halt("validateSnake");
451
430
  }
452
- Object.assign(validateSnake, Namespace.notations.snake("validateSnake"));
453
- Object.assign(validateSnake, Namespace.validate());
454
431
 
455
432
  /* -----------------------------------------------------------
456
433
  FACTORY FUNCTIONS
@@ -482,7 +459,6 @@ export function createCamel<T>(): (input: T) => CamelCase<T>;
482
459
  export function createCamel(): never {
483
460
  halt("createCamel");
484
461
  }
485
- Object.assign(createCamel, Namespace.notations.camel("createCamel"));
486
462
 
487
463
  /**
488
464
  * Creates a reusable {@link assertCamel} function.
@@ -511,14 +487,6 @@ export function createAssertCamel<T>(): (input: T) => CamelCase<T>;
511
487
  export function createAssertCamel(): never {
512
488
  halt("createAssertCamel");
513
489
  }
514
- Object.assign(
515
- createAssertCamel,
516
- Namespace.notations.camel("createAssertCamel"),
517
- );
518
- Object.assign(
519
- createAssertCamel,
520
- Namespace.assert("notations.createAssertCamel"),
521
- );
522
490
 
523
491
  /**
524
492
  * Creates a reusable {@link isCamel} function.
@@ -547,8 +515,6 @@ export function createIsCamel<T>(): (input: T) => CamelCase<T> | null;
547
515
  export function createIsCamel(): never {
548
516
  halt("createIsCamel");
549
517
  }
550
- Object.assign(createIsCamel, Namespace.notations.camel("createIsCamel"));
551
- Object.assign(createIsCamel, Namespace.is());
552
518
 
553
519
  /**
554
520
  * Creates a reusable {@link validateCamel} function.
@@ -579,11 +545,6 @@ export function createValidateCamel<T>(): (
579
545
  export function createValidateCamel(): never {
580
546
  halt("createValidateCamel");
581
547
  }
582
- Object.assign(
583
- createValidateCamel,
584
- Namespace.notations.camel("createValidateCamel"),
585
- );
586
- Object.assign(createValidateCamel, Namespace.validate());
587
548
 
588
549
  /**
589
550
  * Creates a reusable {@link pascal} function.
@@ -612,7 +573,6 @@ export function createPascal<T>(): (input: T) => PascalCase<T>;
612
573
  export function createPascal(): never {
613
574
  halt("createPascal");
614
575
  }
615
- Object.assign(createPascal, Namespace.notations.pascal("createPascal"));
616
576
 
617
577
  /**
618
578
  * Creates a reusable {@link assertPascal} function.
@@ -641,14 +601,6 @@ export function createAssertPascal<T>(): (input: T) => PascalCase<T>;
641
601
  export function createAssertPascal(): never {
642
602
  halt("createAssertPascal");
643
603
  }
644
- Object.assign(
645
- createAssertPascal,
646
- Namespace.notations.pascal("createAssertPascal"),
647
- );
648
- Object.assign(
649
- createAssertPascal,
650
- Namespace.assert("notations.createAssertPascal"),
651
- );
652
604
 
653
605
  /**
654
606
  * Creates a reusable {@link isPascal} function.
@@ -677,8 +629,6 @@ export function createIsPascal<T>(): (input: T) => PascalCase<T> | null;
677
629
  export function createIsPascal(): never {
678
630
  halt("createIsPascal");
679
631
  }
680
- Object.assign(createIsPascal, Namespace.notations.pascal("createIsPascal"));
681
- Object.assign(createIsPascal, Namespace.is());
682
632
 
683
633
  /**
684
634
  * Creates a reusable {@link validatePascal} function.
@@ -709,11 +659,6 @@ export function createValidatePascal<T>(): (
709
659
  export function createValidatePascal(): never {
710
660
  halt("createValidatePascal");
711
661
  }
712
- Object.assign(
713
- createValidatePascal,
714
- Namespace.notations.pascal("createValidatePascal"),
715
- );
716
- Object.assign(createValidatePascal, Namespace.validate());
717
662
 
718
663
  /**
719
664
  * Creates a reusable {@link snake} function.
@@ -742,7 +687,6 @@ export function createSnake<T>(): (input: T) => SnakeCase<T>;
742
687
  export function createSnake(): never {
743
688
  halt("createSnake");
744
689
  }
745
- Object.assign(createSnake, Namespace.notations.snake("createSnake"));
746
690
 
747
691
  /**
748
692
  * Creates a reusable {@link assertSnake} function.
@@ -771,14 +715,6 @@ export function createAssertSnake<T>(): (input: T) => SnakeCase<T>;
771
715
  export function createAssertSnake(): never {
772
716
  halt("createAssertSnake");
773
717
  }
774
- Object.assign(
775
- createAssertSnake,
776
- Namespace.notations.snake("createAssertSnake"),
777
- );
778
- Object.assign(
779
- createAssertSnake,
780
- Namespace.assert("notations.createAssertSnake"),
781
- );
782
718
 
783
719
  /**
784
720
  * Creates a reusable {@link isSnake} function.
@@ -807,8 +743,6 @@ export function createIsSnake<T>(): (input: T) => SnakeCase<T> | null;
807
743
  export function createIsSnake(): never {
808
744
  halt("createIsSnake");
809
745
  }
810
- Object.assign(createIsSnake, Namespace.notations.snake("createIsSnake"));
811
- Object.assign(createIsSnake, Namespace.is());
812
746
 
813
747
  /**
814
748
  * Creates a reusable {@link validateSnake} function.
@@ -839,11 +773,6 @@ export function createValidateSnake<T>(): (
839
773
  export function createValidateSnake(): never {
840
774
  halt("createValidateSnake");
841
775
  }
842
- Object.assign(
843
- createValidateSnake,
844
- Namespace.notations.snake("createValidateSnake"),
845
- );
846
- Object.assign(createValidateSnake, Namespace.validate());
847
776
 
848
777
  /**
849
778
  * @internal
@@ -8,7 +8,7 @@ import { IProject } from "../transformers/IProject";
8
8
 
9
9
  import { CheckerProgrammer } from "./CheckerProgrammer";
10
10
  import { IsProgrammer } from "./IsProgrammer";
11
- import { FunctionImporter } from "./helpers/FunctionImporeter";
11
+ import { FunctionImporter } from "./helpers/FunctionImporter";
12
12
  import { OptionPredicator } from "./helpers/OptionPredicator";
13
13
  import { check_object } from "./internal/check_object";
14
14
 
@@ -84,7 +84,7 @@ export namespace AssertProgrammer {
84
84
  combiner: combiner(props.equals)(project)(importer),
85
85
  joiner: joiner(props.equals)(project)(importer),
86
86
  success: ts.factory.createTrue(),
87
- addition: () => importer.declare(modulo),
87
+ addition: () => importer.declare(),
88
88
  })(importer)(type, name);
89
89
 
90
90
  return ts.factory.createArrowFunction(
@@ -276,7 +276,7 @@ export namespace AssertProgrammer {
276
276
  expected: string,
277
277
  value: ts.Expression,
278
278
  ): ts.Expression =>
279
- ts.factory.createCallExpression(importer.use("guard"), undefined, [
279
+ ts.factory.createCallExpression(importer.use("guard", true), undefined, [
280
280
  exceptionable ?? ts.factory.createIdentifier("_exceptionable"),
281
281
  ts.factory.createObjectLiteralExpression(
282
282
  [
@@ -19,7 +19,7 @@ import { TransformerError } from "../transformers/TransformerError";
19
19
 
20
20
  import { FeatureProgrammer } from "./FeatureProgrammer";
21
21
  import { AtomicPredicator } from "./helpers/AtomicPredicator";
22
- import { FunctionImporter } from "./helpers/FunctionImporeter";
22
+ import { FunctionImporter } from "./helpers/FunctionImporter";
23
23
  import { ICheckEntry } from "./helpers/ICheckEntry";
24
24
  import { IExpressionEntry } from "./helpers/IExpressionEntry";
25
25
  import { OptionPredicator } from "./helpers/OptionPredicator";
@@ -13,7 +13,7 @@ import { MetadataObject } from "../schemas/metadata/MetadataObject";
13
13
  import { IProject } from "../transformers/IProject";
14
14
 
15
15
  import { CheckerProgrammer } from "./CheckerProgrammer";
16
- import { FunctionImporter } from "./helpers/FunctionImporeter";
16
+ import { FunctionImporter } from "./helpers/FunctionImporter";
17
17
  import { IExpressionEntry } from "./helpers/IExpressionEntry";
18
18
  import { UnionExplorer } from "./helpers/UnionExplorer";
19
19
  import { feature_object_entries } from "./internal/feature_object_entries";
@@ -11,7 +11,7 @@ import { MetadataObject } from "../schemas/metadata/MetadataObject";
11
11
  import { IProject } from "../transformers/IProject";
12
12
 
13
13
  import { CheckerProgrammer } from "./CheckerProgrammer";
14
- import { FunctionImporter } from "./helpers/FunctionImporeter";
14
+ import { FunctionImporter } from "./helpers/FunctionImporter";
15
15
  import { IExpressionEntry } from "./helpers/IExpressionEntry";
16
16
  import { OptionPredicator } from "./helpers/OptionPredicator";
17
17
  import { disable_function_importer_declare } from "./helpers/disable_function_importer_declare";
@@ -122,7 +122,7 @@ export namespace IsProgrammer {
122
122
  numeric: OptionPredicator.numeric(project.options),
123
123
  })(project)(importer),
124
124
  trace: equals,
125
- addition: () => importer.declare(modulo),
125
+ addition: () => importer.declare(),
126
126
  };
127
127
 
128
128
  config.decoder = () => (input, target, explore) => {
@@ -21,7 +21,7 @@ import { TransformerError } from "../transformers/TransformerError";
21
21
 
22
22
  import { Escaper } from "../utils/Escaper";
23
23
 
24
- import { FunctionImporter } from "./helpers/FunctionImporeter";
24
+ import { FunctionImporter } from "./helpers/FunctionImporter";
25
25
  import { RandomJoiner } from "./helpers/RandomJoiner";
26
26
  import { RandomRanger } from "./helpers/RandomRanger";
27
27
  import { random_custom } from "./internal/random_custom";
@@ -88,7 +88,7 @@ export namespace RandomProgrammer {
88
88
  undefined,
89
89
  ts.factory.createBlock(
90
90
  [
91
- ...importer.declare(modulo),
91
+ ...importer.declare(),
92
92
  ...functions.objects,
93
93
  ...functions.arrays,
94
94
  ...functions.tuples,
@@ -265,7 +265,7 @@ export namespace RandomProgrammer {
265
265
  // PICK UP A TYPE
266
266
  if (expressions.length === 1) return expressions[0]!;
267
267
  return ts.factory.createCallExpression(
268
- ts.factory.createCallExpression(importer.use("pick"), undefined, [
268
+ ts.factory.createCallExpression(COALESCE(importer)("pick"), undefined, [
269
269
  ts.factory.createArrayLiteralExpression(
270
270
  expressions.map((expr) =>
271
271
  ts.factory.createArrowFunction(
@@ -9,7 +9,7 @@ import { IProject } from "../transformers/IProject";
9
9
 
10
10
  import { CheckerProgrammer } from "./CheckerProgrammer";
11
11
  import { IsProgrammer } from "./IsProgrammer";
12
- import { FunctionImporter } from "./helpers/FunctionImporeter";
12
+ import { FunctionImporter } from "./helpers/FunctionImporter";
13
13
  import { OptionPredicator } from "./helpers/OptionPredicator";
14
14
  import { check_everything } from "./internal/check_everything";
15
15
  import { check_object } from "./internal/check_object";
@@ -84,7 +84,7 @@ export namespace ValidateProgrammer {
84
84
  combiner: combine(equals)(project)(importer),
85
85
  joiner: joiner(equals)(project)(importer),
86
86
  success: ts.factory.createTrue(),
87
- addition: () => importer.declare(modulo),
87
+ addition: () => importer.declare(),
88
88
  })(importer)(type, name);
89
89
 
90
90
  return ts.factory.createArrowFunction(
@@ -121,13 +121,16 @@ export namespace ValidateProgrammer {
121
121
  "$report",
122
122
  ts.factory.createCallExpression(
123
123
  IdentifierFactory.access(
124
- ts.factory.createParenthesizedExpression(
125
- ts.factory.createAsExpression(
126
- modulo,
127
- TypeFactory.keyword("any"),
128
- ),
124
+ ts.factory.createCallExpression(
125
+ ts.factory.createIdentifier("require"),
126
+ [],
127
+ [
128
+ ts.factory.createStringLiteral(
129
+ "typia/lib/functional/$report",
130
+ ),
131
+ ],
129
132
  ),
130
- )("report"),
133
+ )("$report"),
131
134
  [],
132
135
  [ts.factory.createIdentifier("errors")],
133
136
  ),
@@ -2,10 +2,9 @@ import ts from "typescript";
2
2
 
3
3
  import { IdentifierFactory } from "../../factories/IdentifierFactory";
4
4
  import { StatementFactory } from "../../factories/StatementFactory";
5
- import { TypeFactory } from "../../factories/TypeFactory";
6
5
 
7
6
  export class FunctionImporter {
8
- private readonly used_: Set<string> = new Set();
7
+ private readonly used_: Map<string, boolean> = new Map();
9
8
  private readonly local_: Set<string> = new Set();
10
9
  private readonly unions_: Map<string, [string, ts.ArrowFunction]> = new Map();
11
10
  private sequence_: number = 0;
@@ -16,8 +15,8 @@ export class FunctionImporter {
16
15
  return this.used_.size === 0;
17
16
  }
18
17
 
19
- public use(name: string): ts.Identifier {
20
- this.used_.add(name);
18
+ public use(name: string, currying: boolean = false): ts.Identifier {
19
+ this.used_.set(name, !!currying);
21
20
  return ts.factory.createIdentifier("$" + name);
22
21
  }
23
22
 
@@ -30,21 +29,25 @@ export class FunctionImporter {
30
29
  return this.local_.has(name);
31
30
  }
32
31
 
33
- public declare(
34
- modulo: ts.LeftHandSideExpression,
35
- includeUnions: boolean = true,
36
- ): ts.Statement[] {
32
+ public declare(includeUnions: boolean = true): ts.Statement[] {
37
33
  return [
38
- ...[...this.used_].map((name) =>
39
- StatementFactory.constant(
40
- "$" + name,
41
- IdentifierFactory.access(
42
- ts.factory.createParenthesizedExpression(
43
- ts.factory.createAsExpression(modulo, TypeFactory.keyword("any")),
44
- ),
45
- )(name),
46
- ),
47
- ),
34
+ ...[...this.used_].map(([key, value]) => {
35
+ const accessor = IdentifierFactory.access(
36
+ ts.factory.createCallExpression(
37
+ ts.factory.createIdentifier("require"),
38
+ undefined,
39
+ [ts.factory.createStringLiteral(`typia/lib/functional/$${key}`)],
40
+ ),
41
+ )(`$${key}`);
42
+ return StatementFactory.constant(
43
+ `$${key}`,
44
+ value
45
+ ? ts.factory.createCallExpression(accessor, undefined, [
46
+ ts.factory.createStringLiteral(this.method),
47
+ ])
48
+ : accessor,
49
+ );
50
+ }),
48
51
  ...(includeUnions === true
49
52
  ? [...this.unions_.values()].map(([key, arrow]) =>
50
53
  StatementFactory.constant(key, arrow),
@@ -5,7 +5,7 @@ import { TemplateFactory } from "../../factories/TemplateFactory";
5
5
 
6
6
  import { stringify_dynamic_properties } from "../internal/stringify_dynamic_properties";
7
7
  import { stringify_regular_properties } from "../internal/stringify_regular_properties";
8
- import { FunctionImporter } from "./FunctionImporeter";
8
+ import { FunctionImporter } from "./FunctionImporter";
9
9
  import { IExpressionEntry } from "./IExpressionEntry";
10
10
 
11
11
  export namespace StringifyJoiner {
@@ -65,14 +65,13 @@ export namespace StringifyJoiner {
65
65
  TemplateFactory.generate([
66
66
  ts.factory.createStringLiteral(`[`),
67
67
  ts.factory.createCallExpression(
68
- ts.factory.createPropertyAccessExpression(
68
+ IdentifierFactory.access(
69
69
  ts.factory.createCallExpression(
70
70
  IdentifierFactory.access(input)("map"),
71
71
  undefined,
72
72
  [arrow],
73
73
  ),
74
- ts.factory.createIdentifier("join"),
75
- ),
74
+ )("join"),
76
75
  undefined,
77
76
  [ts.factory.createStringLiteral(`,`)],
78
77
  ),
@@ -1,6 +1,6 @@
1
1
  import ts from "typescript";
2
2
 
3
- import { FunctionImporter } from "./FunctionImporeter";
3
+ import { FunctionImporter } from "./FunctionImporter";
4
4
 
5
5
  export const disable_function_importer_declare = (
6
6
  importer: FunctionImporter,
@@ -9,10 +9,11 @@ export const disable_function_importer_declare = (
9
9
  const disable = (importer: FunctionImporter): MethodOnly<FunctionImporter> => ({
10
10
  method: importer.method,
11
11
  empty: (): boolean => importer.empty(),
12
- use: (name: string): ts.Identifier => importer.use(name),
12
+ use: (name: string, currying?: boolean): ts.Identifier =>
13
+ importer.use(name, currying),
13
14
  useLocal: (name: string): string => importer.useLocal(name),
14
15
  hasLocal: (name: string): boolean => importer.hasLocal(name),
15
- declare: (_modulo: ts.LeftHandSideExpression): ts.Statement[] => [],
16
+ declare: (): ts.Statement[] => [],
16
17
  declareUnions: (): ts.Statement[] => [],
17
18
  increment: (): number => importer.increment(),
18
19
  emplaceUnion: (
@@ -20,7 +20,7 @@ import { Atomic } from "../../typings/Atomic";
20
20
  import { Escaper } from "../../utils/Escaper";
21
21
  import { MapUtil } from "../../utils/MapUtil";
22
22
 
23
- import { FunctionImporter } from "../helpers/FunctionImporeter";
23
+ import { FunctionImporter } from "../helpers/FunctionImporter";
24
24
  import { HttpMetadataUtil } from "../helpers/HttpMetadataUtil";
25
25
 
26
26
  export namespace HttpHeadersProgrammer {
@@ -65,10 +65,7 @@ export namespace HttpHeadersProgrammer {
65
65
  }>`,
66
66
  ),
67
67
  undefined,
68
- ts.factory.createBlock(
69
- [...importer.declare(modulo), ...statements],
70
- true,
71
- ),
68
+ ts.factory.createBlock([...importer.declare(), ...statements], true),
72
69
  );
73
70
  };
74
71
 
@@ -243,7 +240,7 @@ export namespace HttpHeadersProgrammer {
243
240
  (value: ts.Expression) =>
244
241
  type === "string"
245
242
  ? value
246
- : ts.factory.createCallExpression(importer.use(type), undefined, [
243
+ : ts.factory.createCallExpression(reader(importer)(type), undefined, [
247
244
  value,
248
245
  ]);
249
246
 
@@ -270,7 +267,7 @@ export namespace HttpHeadersProgrammer {
270
267
  ),
271
268
  undefined,
272
269
  undefined,
273
- [importer.use(type)],
270
+ [reader(importer)(type)],
274
271
  );
275
272
  return ts.factory.createConditionalExpression(
276
273
  ExpressionFactory.isArray(accessor),
@@ -278,7 +275,7 @@ export namespace HttpHeadersProgrammer {
278
275
  ts.factory.createCallExpression(
279
276
  IdentifierFactory.access(accessor)("map"),
280
277
  undefined,
281
- [importer.use(type)],
278
+ [reader(importer)(type)],
282
279
  ),
283
280
  undefined,
284
281
  value.isRequired() === false
@@ -312,3 +309,6 @@ const SINGULAR: Set<string> = new Set([
312
309
  "server",
313
310
  "user-agent",
314
311
  ]);
312
+
313
+ const reader = (importer: FunctionImporter) => (type: Atomic.Literal) =>
314
+ IdentifierFactory.access(importer.use("HeadersReader"))(type);
@@ -12,7 +12,7 @@ import { IProject } from "../../transformers/IProject";
12
12
  import { TransformerError } from "../../transformers/TransformerError";
13
13
 
14
14
  import { AssertProgrammer } from "../AssertProgrammer";
15
- import { FunctionImporter } from "../helpers/FunctionImporeter";
15
+ import { FunctionImporter } from "../helpers/FunctionImporter";
16
16
  import { HttpMetadataUtil } from "../helpers/HttpMetadataUtil";
17
17
 
18
18
  export namespace HttpParameterProgrammer {
@@ -46,9 +46,11 @@ export namespace HttpParameterProgrammer {
46
46
  ),
47
47
  StatementFactory.constant(
48
48
  "value",
49
- ts.factory.createCallExpression(importer.use(atomic), undefined, [
50
- ts.factory.createIdentifier("input"),
51
- ]),
49
+ ts.factory.createCallExpression(
50
+ IdentifierFactory.access(importer.use("ParameterReader"))(atomic),
51
+ undefined,
52
+ [ts.factory.createIdentifier("input")],
53
+ ),
52
54
  ),
53
55
  ts.factory.createReturnStatement(
54
56
  ts.factory.createCallExpression(
@@ -72,7 +74,7 @@ export namespace HttpParameterProgrammer {
72
74
  name ?? TypeFactory.getFullName(project.checker)(type),
73
75
  ),
74
76
  undefined,
75
- ts.factory.createBlock([...importer.declare(modulo), ...block], true),
77
+ ts.factory.createBlock([...importer.declare(), ...block], true),
76
78
  );
77
79
  };
78
80
 
@@ -18,7 +18,7 @@ import { Atomic } from "../../typings/Atomic";
18
18
 
19
19
  import { Escaper } from "../../utils/Escaper";
20
20
 
21
- import { FunctionImporter } from "../helpers/FunctionImporeter";
21
+ import { FunctionImporter } from "../helpers/FunctionImporter";
22
22
  import { HttpMetadataUtil } from "../helpers/HttpMetadataUtil";
23
23
 
24
24
  export namespace HttpQueryProgrammer {
@@ -63,10 +63,7 @@ export namespace HttpQueryProgrammer {
63
63
  }>`,
64
64
  ),
65
65
  undefined,
66
- ts.factory.createBlock(
67
- [...importer.declare(modulo), ...statements],
68
- true,
69
- ),
66
+ ts.factory.createBlock([...importer.declare(), ...statements], true),
70
67
  );
71
68
  };
72
69
 
@@ -135,7 +132,7 @@ export namespace HttpQueryProgrammer {
135
132
  ts.factory.createToken(ts.SyntaxKind.EqualsToken),
136
133
  ts.factory.createAsExpression(
137
134
  ts.factory.createCallExpression(
138
- importer.use("params"),
135
+ IdentifierFactory.access(importer.use("QueryReader"))("params"),
139
136
  undefined,
140
137
  [input],
141
138
  ),
@@ -224,7 +221,7 @@ export namespace HttpQueryProgrammer {
224
221
  (onlyUndefindable: boolean) =>
225
222
  (value: ts.Expression) => {
226
223
  const call = ts.factory.createCallExpression(
227
- importer.use(type),
224
+ IdentifierFactory.access(importer.use("QueryReader"))(type),
228
225
  undefined,
229
226
  [value],
230
227
  );
@@ -242,11 +239,15 @@ export namespace HttpQueryProgrammer {
242
239
  (value: Metadata) =>
243
240
  (expression: ts.Expression): ts.Expression =>
244
241
  value.nullable || value.isRequired() === false
245
- ? ts.factory.createCallExpression(importer.use("array"), undefined, [
246
- expression,
247
- value.nullable
248
- ? ts.factory.createNull()
249
- : ts.factory.createIdentifier("undefined"),
250
- ])
242
+ ? ts.factory.createCallExpression(
243
+ IdentifierFactory.access(importer.use("QueryReader"))("array"),
244
+ undefined,
245
+ [
246
+ expression,
247
+ value.nullable
248
+ ? ts.factory.createNull()
249
+ : ts.factory.createIdentifier("undefined"),
250
+ ],
251
+ )
251
252
  : expression;
252
253
  }
@@ -4,7 +4,7 @@ import { Metadata } from "../../schemas/metadata/Metadata";
4
4
 
5
5
  import { IProject } from "../../transformers/IProject";
6
6
 
7
- import { FunctionImporter } from "../helpers/FunctionImporeter";
7
+ import { FunctionImporter } from "../helpers/FunctionImporter";
8
8
  import { ICheckEntry } from "../helpers/ICheckEntry";
9
9
  import { check_bigint } from "./check_bigint";
10
10
  import { check_number } from "./check_number";
@@ -6,7 +6,7 @@ import { StatementFactory } from "../../factories/StatementFactory";
6
6
 
7
7
  import { IProject } from "../../transformers/IProject";
8
8
 
9
- import { FunctionImporter } from "../helpers/FunctionImporeter";
9
+ import { FunctionImporter } from "../helpers/FunctionImporter";
10
10
  import { IExpressionEntry } from "../helpers/IExpressionEntry";
11
11
  import { check_dynamic_key } from "./check_dynamic_key";
12
12
  import { check_everything } from "./check_everything";
@@ -2,7 +2,7 @@ import ts from "typescript";
2
2
 
3
3
  import { IProject } from "../../transformers/IProject";
4
4
 
5
- import { FunctionImporter } from "../helpers/FunctionImporeter";
5
+ import { FunctionImporter } from "../helpers/FunctionImporter";
6
6
  import { IExpressionEntry } from "../helpers/IExpressionEntry";
7
7
  import { check_dynamic_properties } from "./check_dynamic_properties";
8
8
  import { check_everything } from "./check_everything";
@@ -7,7 +7,7 @@ import { MetadataObject } from "../../schemas/metadata/MetadataObject";
7
7
  import { Escaper } from "../../utils/Escaper";
8
8
 
9
9
  import { FeatureProgrammer } from "../FeatureProgrammer";
10
- import { FunctionImporter } from "../helpers/FunctionImporeter";
10
+ import { FunctionImporter } from "../helpers/FunctionImporter";
11
11
 
12
12
  /**
13
13
  * @internal