typia 12.1.1 → 12.2.0

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 (136) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +153 -153
  3. package/lib/executable/setup/PluginConfigurator.js +3 -3
  4. package/lib/executable/setup/PluginConfigurator.mjs +3 -3
  5. package/lib/executable/setup/PluginConfigurator.mjs.map +1 -1
  6. package/lib/executable/typia.js +15 -15
  7. package/lib/executable/typia.mjs +15 -15
  8. package/package.json +5 -5
  9. package/src/TypeGuardError.ts +145 -145
  10. package/src/executable/TypiaGenerateWizard.ts +82 -82
  11. package/src/executable/TypiaPatchWizard.ts +45 -45
  12. package/src/executable/TypiaSetupWizard.ts +171 -171
  13. package/src/executable/setup/ArgumentParser.ts +42 -42
  14. package/src/executable/setup/CommandExecutor.ts +8 -8
  15. package/src/executable/setup/FileRetriever.ts +19 -19
  16. package/src/executable/setup/PackageManager.ts +87 -87
  17. package/src/executable/setup/PluginConfigurator.ts +74 -74
  18. package/src/executable/typia.ts +55 -55
  19. package/src/functional.ts +600 -600
  20. package/src/http.ts +843 -843
  21. package/src/index.ts +4 -4
  22. package/src/internal/_IProtobufWriter.ts +18 -18
  23. package/src/internal/_ProtobufReader.ts +187 -187
  24. package/src/internal/_ProtobufSizer.ts +137 -137
  25. package/src/internal/_ProtobufWriter.ts +135 -135
  26. package/src/internal/_accessExpressionAsString.ts +46 -46
  27. package/src/internal/_assertGuard.ts +13 -13
  28. package/src/internal/_coerceLlmArguments.ts +7 -7
  29. package/src/internal/_createStandardSchema.ts +133 -133
  30. package/src/internal/_functionalTypeGuardErrorFactory.ts +4 -4
  31. package/src/internal/_httpFormDataReadArray.ts +4 -4
  32. package/src/internal/_httpFormDataReadBigint.ts +18 -18
  33. package/src/internal/_httpFormDataReadBlob.ts +10 -10
  34. package/src/internal/_httpFormDataReadBoolean.ts +16 -16
  35. package/src/internal/_httpFormDataReadFile.ts +10 -10
  36. package/src/internal/_httpFormDataReadNumber.ts +15 -15
  37. package/src/internal/_httpFormDataReadString.ts +10 -10
  38. package/src/internal/_httpHeaderReadBigint.ts +10 -10
  39. package/src/internal/_httpHeaderReadBoolean.ts +8 -8
  40. package/src/internal/_httpHeaderReadNumber.ts +7 -7
  41. package/src/internal/_httpParameterReadBigint.ts +10 -10
  42. package/src/internal/_httpParameterReadBoolean.ts +8 -8
  43. package/src/internal/_httpParameterReadNumber.ts +7 -7
  44. package/src/internal/_httpParameterReadString.ts +2 -2
  45. package/src/internal/_httpQueryParseURLSearchParams.ts +12 -12
  46. package/src/internal/_httpQueryReadArray.ts +4 -4
  47. package/src/internal/_httpQueryReadBigint.ts +12 -12
  48. package/src/internal/_httpQueryReadBoolean.ts +14 -14
  49. package/src/internal/_httpQueryReadNumber.ts +9 -9
  50. package/src/internal/_httpQueryReadString.ts +4 -4
  51. package/src/internal/_isBetween.ts +2 -2
  52. package/src/internal/_isBigintString.ts +8 -8
  53. package/src/internal/_isFormatByte.ts +7 -7
  54. package/src/internal/_isFormatDate.ts +3 -3
  55. package/src/internal/_isFormatDateTime.ts +4 -4
  56. package/src/internal/_isFormatDuration.ts +4 -4
  57. package/src/internal/_isFormatEmail.ts +4 -4
  58. package/src/internal/_isFormatHostname.ts +4 -4
  59. package/src/internal/_isFormatIdnEmail.ts +4 -4
  60. package/src/internal/_isFormatIdnHostname.ts +4 -4
  61. package/src/internal/_isFormatIpv4.ts +4 -4
  62. package/src/internal/_isFormatIpv6.ts +4 -4
  63. package/src/internal/_isFormatIri.ts +3 -3
  64. package/src/internal/_isFormatIriReference.ts +4 -4
  65. package/src/internal/_isFormatJsonPointer.ts +3 -3
  66. package/src/internal/_isFormatPassword.ts +1 -1
  67. package/src/internal/_isFormatRegex.ts +8 -8
  68. package/src/internal/_isFormatRelativeJsonPointer.ts +4 -4
  69. package/src/internal/_isFormatTime.ts +4 -4
  70. package/src/internal/_isFormatUri.ts +6 -6
  71. package/src/internal/_isFormatUriReference.ts +5 -5
  72. package/src/internal/_isFormatUriTemplate.ts +4 -4
  73. package/src/internal/_isFormatUrl.ts +4 -4
  74. package/src/internal/_isFormatUuid.ts +3 -3
  75. package/src/internal/_isTypeFloat.ts +5 -5
  76. package/src/internal/_isTypeInt32.ts +5 -5
  77. package/src/internal/_isTypeInt64.ts +5 -5
  78. package/src/internal/_isTypeUint32.ts +5 -5
  79. package/src/internal/_isTypeUint64.ts +5 -5
  80. package/src/internal/_isUniqueItems.ts +159 -159
  81. package/src/internal/_jsonStringifyNumber.ts +2 -2
  82. package/src/internal/_jsonStringifyRest.ts +3 -3
  83. package/src/internal/_jsonStringifyString.ts +42 -42
  84. package/src/internal/_jsonStringifyTail.ts +2 -2
  85. package/src/internal/_llmApplicationFinalize.ts +20 -20
  86. package/src/internal/_miscCloneAny.ts +46 -46
  87. package/src/internal/_notationAny.ts +37 -37
  88. package/src/internal/_notationCamel.ts +13 -13
  89. package/src/internal/_notationPascal.ts +8 -8
  90. package/src/internal/_notationSnake.ts +43 -43
  91. package/src/internal/_parseLlmArguments.ts +7 -7
  92. package/src/internal/_randomArray.ts +21 -21
  93. package/src/internal/_randomBigint.ts +6 -6
  94. package/src/internal/_randomBoolean.ts +1 -1
  95. package/src/internal/_randomFormatByte.ts +3 -3
  96. package/src/internal/_randomFormatDate.ts +18 -18
  97. package/src/internal/_randomFormatDatetime.ts +16 -16
  98. package/src/internal/_randomFormatDuration.ts +27 -27
  99. package/src/internal/_randomFormatEmail.ts +11 -11
  100. package/src/internal/_randomFormatHostname.ts +6 -6
  101. package/src/internal/_randomFormatIdnEmail.ts +3 -3
  102. package/src/internal/_randomFormatIdnHostname.ts +3 -3
  103. package/src/internal/_randomFormatIpv4.ts +11 -11
  104. package/src/internal/_randomFormatIpv6.ts +11 -11
  105. package/src/internal/_randomFormatIri.ts +3 -3
  106. package/src/internal/_randomFormatIriReference.ts +3 -3
  107. package/src/internal/_randomFormatJsonPointer.ts +7 -7
  108. package/src/internal/_randomFormatPassword.ts +8 -8
  109. package/src/internal/_randomFormatRegex.ts +4 -4
  110. package/src/internal/_randomFormatRelativeJsonPointer.ts +8 -8
  111. package/src/internal/_randomFormatTime.ts +14 -14
  112. package/src/internal/_randomFormatUri.ts +3 -3
  113. package/src/internal/_randomFormatUriReference.ts +3 -3
  114. package/src/internal/_randomFormatUriTemplate.ts +3 -3
  115. package/src/internal/_randomFormatUrl.ts +11 -11
  116. package/src/internal/_randomFormatUuid.ts +6 -6
  117. package/src/internal/_randomInteger.ts +53 -53
  118. package/src/internal/_randomNumber.ts +80 -80
  119. package/src/internal/_randomPattern.ts +10 -10
  120. package/src/internal/_randomPick.ts +9 -9
  121. package/src/internal/_randomString.ts +24 -24
  122. package/src/internal/_throwTypeGuardError.ts +5 -5
  123. package/src/internal/_validateReport.ts +21 -21
  124. package/src/internal/private/__notationCapitalize.ts +2 -2
  125. package/src/internal/private/__notationUnsnake.ts +24 -24
  126. package/src/json.ts +553 -553
  127. package/src/llm.ts +480 -480
  128. package/src/misc.ts +448 -448
  129. package/src/module.ts +811 -811
  130. package/src/notations.ts +624 -624
  131. package/src/programmers/TypiaProgrammer.ts +8 -8
  132. package/src/protobuf.ts +499 -499
  133. package/src/re-exports.ts +34 -34
  134. package/src/reflect.ts +75 -75
  135. package/src/transform.ts +6 -6
  136. package/src/transformers/NoTransformConfigurationError.ts +16 -16
@@ -1,74 +1,74 @@
1
- import comments from "comment-json";
2
- import fs from "fs";
3
-
4
- import { TypiaSetupWizard } from "../TypiaSetupWizard";
5
-
6
- export namespace PluginConfigurator {
7
- export async function configure(
8
- args: TypiaSetupWizard.IArguments,
9
- ): Promise<void> {
10
- // GET COMPILER-OPTIONS
11
- const config: comments.CommentObject = comments.parse(
12
- await fs.promises.readFile(args.project!, "utf8"),
13
- ) as comments.CommentObject;
14
- const compilerOptions = config.compilerOptions as
15
- | comments.CommentObject
16
- | undefined;
17
- if (compilerOptions === undefined)
18
- throw new ReferenceError(
19
- `${args.project} file does not have "compilerOptions" property.`,
20
- );
21
-
22
- // PREPARE PLUGINS
23
- const plugins: comments.CommentArray<comments.CommentObject> = (() => {
24
- const plugins = compilerOptions.plugins as
25
- | comments.CommentArray<comments.CommentObject>
26
- | undefined;
27
- if (plugins === undefined) return (compilerOptions.plugins = [] as any);
28
- else if (!Array.isArray(plugins))
29
- throw new TypeError(
30
- `"plugins" property of ${args.project} must be array type.`,
31
- );
32
- return plugins;
33
- })();
34
-
35
- const strict: boolean | undefined = compilerOptions.strict as
36
- | boolean
37
- | undefined;
38
- const strictNullChecks: boolean | undefined =
39
- compilerOptions.strictNullChecks as boolean | undefined;
40
- const skipLibCheck: boolean | undefined = compilerOptions.skipLibCheck as
41
- | boolean
42
- | undefined;
43
- const oldbie: comments.CommentObject | undefined = plugins.find(
44
- (p) =>
45
- typeof p === "object" &&
46
- p !== null &&
47
- p.transform === "typia/lib/transform",
48
- );
49
- if (
50
- strictNullChecks !== false &&
51
- (strict === true || strictNullChecks === true) &&
52
- oldbie !== undefined &&
53
- skipLibCheck === true
54
- )
55
- return;
56
-
57
- // DO CONFIGURE
58
- compilerOptions.skipLibCheck = true;
59
- compilerOptions.strictNullChecks = true;
60
- if (strict === undefined && strictNullChecks === undefined)
61
- compilerOptions.strict = true;
62
- if (oldbie === undefined)
63
- plugins.push(
64
- comments.parse(`
65
- {
66
- "transform": "typia/lib/transform"
67
- }`) as comments.CommentObject,
68
- );
69
- await fs.promises.writeFile(
70
- args.project!,
71
- comments.stringify(config, null, 2),
72
- );
73
- }
74
- }
1
+ import comments from "comment-json";
2
+ import fs from "fs";
3
+
4
+ import { TypiaSetupWizard } from "../TypiaSetupWizard";
5
+
6
+ export namespace PluginConfigurator {
7
+ export async function configure(
8
+ args: TypiaSetupWizard.IArguments,
9
+ ): Promise<void> {
10
+ // GET COMPILER-OPTIONS
11
+ const config: comments.CommentObject = comments.parse(
12
+ await fs.promises.readFile(args.project!, "utf8"),
13
+ ) as comments.CommentObject;
14
+ const compilerOptions = config.compilerOptions as
15
+ | comments.CommentObject
16
+ | undefined;
17
+ if (compilerOptions === undefined)
18
+ throw new ReferenceError(
19
+ `${args.project} file does not have "compilerOptions" property.`,
20
+ );
21
+
22
+ // PREPARE PLUGINS
23
+ const plugins: comments.CommentArray<comments.CommentObject> = (() => {
24
+ const plugins = compilerOptions.plugins as
25
+ | comments.CommentArray<comments.CommentObject>
26
+ | undefined;
27
+ if (plugins === undefined) return (compilerOptions.plugins = [] as any);
28
+ else if (!Array.isArray(plugins))
29
+ throw new TypeError(
30
+ `"plugins" property of ${args.project} must be array type.`,
31
+ );
32
+ return plugins;
33
+ })();
34
+
35
+ const strict: boolean | undefined = compilerOptions.strict as
36
+ | boolean
37
+ | undefined;
38
+ const strictNullChecks: boolean | undefined =
39
+ compilerOptions.strictNullChecks as boolean | undefined;
40
+ const skipLibCheck: boolean | undefined = compilerOptions.skipLibCheck as
41
+ | boolean
42
+ | undefined;
43
+ const oldbie: comments.CommentObject | undefined = plugins.find(
44
+ (p) =>
45
+ typeof p === "object" &&
46
+ p !== null &&
47
+ p.transform === "typia/lib/transform",
48
+ );
49
+ if (
50
+ strictNullChecks !== false &&
51
+ (strict === true || strictNullChecks === true) &&
52
+ oldbie !== undefined &&
53
+ skipLibCheck === true
54
+ )
55
+ return;
56
+
57
+ // DO CONFIGURE
58
+ compilerOptions.skipLibCheck = true;
59
+ compilerOptions.strictNullChecks = true;
60
+ if (strict === undefined && strictNullChecks === undefined)
61
+ compilerOptions.strict = true;
62
+ if (oldbie === undefined)
63
+ plugins.push(
64
+ comments.parse(`
65
+ {
66
+ "transform": "typia/lib/transform"
67
+ }`) as comments.CommentObject,
68
+ );
69
+ await fs.promises.writeFile(
70
+ args.project!,
71
+ comments.stringify(config, null, 2),
72
+ );
73
+ }
74
+ }
@@ -1,55 +1,55 @@
1
- #!/usr/bin/env node
2
- const USAGE = `Wrong command has been detected. Use like below:
3
-
4
- npx typia setup \\
5
- --manager (npm|pnpm|yarn) \\
6
- --project {tsconfig.json file path}
7
-
8
- - npx typia setup
9
- - npx typia setup --manager pnpm
10
- - npx typia setup --project tsconfig.test.json
11
-
12
- npx typia generate
13
- --input {directory} \\
14
- --output {directory}
15
-
16
- --npx typia generate --input src/templates --output src/functional
17
- `;
18
-
19
- const halt = (desc: string): never => {
20
- console.error(desc);
21
- process.exit(-1);
22
- };
23
-
24
- const main = async (): Promise<void> => {
25
- try {
26
- await import("comment-json");
27
- await import("inquirer");
28
- await import("commander");
29
- } catch {
30
- halt(`typia has not been installed. Run "npm i typia" before.`);
31
- }
32
-
33
- const type: string | undefined = process.argv[2];
34
- if (type === "setup") {
35
- const { TypiaSetupWizard } = await import("./TypiaSetupWizard.js");
36
- await TypiaSetupWizard.setup();
37
- } else if (type === "patch") {
38
- const { TypiaPatchWizard } = await import("./TypiaPatchWizard.js");
39
- await TypiaPatchWizard.main();
40
- } else if (type === "generate") {
41
- try {
42
- await import("typescript");
43
- } catch {
44
- halt(
45
- `typescript has not been installed. Run "npm i -D typescript" before.`,
46
- );
47
- }
48
- const { TypiaGenerateWizard } = await import("./TypiaGenerateWizard.js");
49
- await TypiaGenerateWizard.generate();
50
- } else halt(USAGE);
51
- };
52
- main().catch((exp) => {
53
- console.error(exp);
54
- process.exit(-1);
55
- });
1
+ #!/usr/bin/env node
2
+ const USAGE = `Wrong command has been detected. Use like below:
3
+
4
+ npx typia setup \\
5
+ --manager (npm|pnpm|yarn) \\
6
+ --project {tsconfig.json file path}
7
+
8
+ - npx typia setup
9
+ - npx typia setup --manager pnpm
10
+ - npx typia setup --project tsconfig.test.json
11
+
12
+ npx typia generate
13
+ --input {directory} \\
14
+ --output {directory}
15
+
16
+ --npx typia generate --input src/templates --output src/functional
17
+ `;
18
+
19
+ const halt = (desc: string): never => {
20
+ console.error(desc);
21
+ process.exit(-1);
22
+ };
23
+
24
+ const main = async (): Promise<void> => {
25
+ try {
26
+ await import("comment-json");
27
+ await import("inquirer");
28
+ await import("commander");
29
+ } catch {
30
+ halt(`typia has not been installed. Run "npm i typia" before.`);
31
+ }
32
+
33
+ const type: string | undefined = process.argv[2];
34
+ if (type === "setup") {
35
+ const { TypiaSetupWizard } = await import("./TypiaSetupWizard.js");
36
+ await TypiaSetupWizard.setup();
37
+ } else if (type === "patch") {
38
+ const { TypiaPatchWizard } = await import("./TypiaPatchWizard.js");
39
+ await TypiaPatchWizard.main();
40
+ } else if (type === "generate") {
41
+ try {
42
+ await import("typescript");
43
+ } catch {
44
+ halt(
45
+ `typescript has not been installed. Run "npm i -D typescript" before.`,
46
+ );
47
+ }
48
+ const { TypiaGenerateWizard } = await import("./TypiaGenerateWizard.js");
49
+ await TypiaGenerateWizard.generate();
50
+ } else halt(USAGE);
51
+ };
52
+ main().catch((exp) => {
53
+ console.error(exp);
54
+ process.exit(-1);
55
+ });