typia 7.6.0-dev.20241229 → 7.6.1-dev.20250203

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 (170) hide show
  1. package/README.md +2 -1
  2. package/lib/IReadableURLSearchParams.d.ts +1 -1
  3. package/lib/TypeGuardError.mjs +26 -0
  4. package/lib/TypeGuardError.mjs.map +1 -0
  5. package/lib/executable/setup/PluginConfigurator.js +3 -3
  6. package/lib/executable/typia.js +15 -15
  7. package/lib/factories/MetadataTypeTagFactory.js +1 -1
  8. package/lib/factories/MetadataTypeTagFactory.js.map +1 -1
  9. package/lib/factories/ProtobufFactory.js +4 -4
  10. package/lib/factories/ProtobufFactory.js.map +1 -1
  11. package/lib/factories/internal/metadata/iterate_metadata_intersection.js +1 -1
  12. package/lib/factories/internal/metadata/iterate_metadata_intersection.js.map +1 -1
  13. package/lib/functional.mjs +120 -0
  14. package/lib/functional.mjs.map +1 -0
  15. package/lib/http.d.ts +16 -16
  16. package/lib/http.mjs +165 -0
  17. package/lib/http.mjs.map +1 -0
  18. package/lib/index.mjs +27 -1142
  19. package/lib/index.mjs.map +1 -1
  20. package/lib/internal/_isUniqueItems.js +1 -1
  21. package/lib/json.d.ts +5 -5
  22. package/lib/json.mjs +105 -0
  23. package/lib/json.mjs.map +1 -0
  24. package/lib/llm.d.ts +8 -8
  25. package/lib/llm.mjs +33 -0
  26. package/lib/llm.mjs.map +1 -0
  27. package/lib/misc.d.ts +10 -10
  28. package/lib/misc.mjs +111 -0
  29. package/lib/misc.mjs.map +1 -0
  30. package/lib/module.d.ts +5 -5
  31. package/lib/module.mjs +139 -0
  32. package/lib/module.mjs.map +1 -0
  33. package/lib/notations.mjs +153 -0
  34. package/lib/notations.mjs.map +1 -0
  35. package/lib/programmers/FeatureProgrammer.d.ts +3 -3
  36. package/lib/programmers/TypiaProgrammer.js +1 -1
  37. package/lib/programmers/TypiaProgrammer.js.map +1 -1
  38. package/lib/programmers/helpers/UnionExplorer.js +1 -1
  39. package/lib/programmers/helpers/UnionExplorer.js.map +1 -1
  40. package/lib/programmers/helpers/UnionPredicator.d.ts +1 -1
  41. package/lib/programmers/helpers/UnionPredicator.js +1 -1
  42. package/lib/programmers/helpers/UnionPredicator.js.map +1 -1
  43. package/lib/programmers/json/JsonApplicationProgrammer.d.ts +12 -0
  44. package/lib/programmers/json/JsonApplicationProgrammer.js +23 -23
  45. package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
  46. package/lib/programmers/llm/LlmApplicationOfValidateProgrammer.js +15 -7
  47. package/lib/programmers/llm/LlmApplicationOfValidateProgrammer.js.map +1 -1
  48. package/lib/programmers/llm/LlmApplicationProgrammer.js +40 -16
  49. package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
  50. package/lib/programmers/llm/LlmParametersProgrammer.js +1 -1
  51. package/lib/programmers/llm/LlmParametersProgrammer.js.map +1 -1
  52. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +1 -1
  53. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
  54. package/lib/protobuf.d.ts +9 -9
  55. package/lib/protobuf.mjs +111 -0
  56. package/lib/protobuf.mjs.map +1 -0
  57. package/lib/reflect.mjs +18 -0
  58. package/lib/reflect.mjs.map +1 -0
  59. package/lib/schemas/llm/ILlmApplicationOfValidate.d.ts +2 -2
  60. package/lib/schemas/llm/ILlmApplicationOfValidate.mjs +6 -0
  61. package/lib/schemas/llm/ILlmApplicationOfValidate.mjs.map +1 -0
  62. package/lib/schemas/llm/ILlmFunctionOfValidate.mjs +6 -0
  63. package/lib/schemas/llm/ILlmFunctionOfValidate.mjs.map +1 -0
  64. package/lib/tags/TagBase.d.ts +1 -1
  65. package/lib/tags/Type.d.ts +0 -1
  66. package/lib/tags/index.mjs +2 -0
  67. package/lib/tags/index.mjs.map +1 -0
  68. package/lib/transformers/ImportTransformer.js +3 -3
  69. package/lib/transformers/ImportTransformer.js.map +1 -1
  70. package/lib/transformers/features/json/JsonValidateParseTransformer.js +1 -1
  71. package/lib/transformers/features/json/JsonValidateParseTransformer.js.map +1 -1
  72. package/lib/transformers/features/json/JsonValidateStringifyTransformer.js +1 -1
  73. package/lib/transformers/features/json/JsonValidateStringifyTransformer.js.map +1 -1
  74. package/lib/transformers/features/misc/MiscValidateCloneTransformer.js +1 -1
  75. package/lib/transformers/features/misc/MiscValidateCloneTransformer.js.map +1 -1
  76. package/lib/transformers/features/misc/MiscValidatePruneTransformer.js +1 -1
  77. package/lib/transformers/features/misc/MiscValidatePruneTransformer.js.map +1 -1
  78. package/lib/transformers/features/reflect/ReflectNameTransformer.js +1 -1
  79. package/package.json +11 -8
  80. package/src/AssertionGuard.ts +1 -1
  81. package/src/CamelCase.ts +75 -75
  82. package/src/IReadableURLSearchParams.ts +1 -1
  83. package/src/PascalCase.ts +71 -71
  84. package/src/Primitive.ts +92 -92
  85. package/src/Resolved.ts +74 -74
  86. package/src/SnakeCase.ts +126 -126
  87. package/src/TypeGuardError.ts +37 -37
  88. package/src/executable/setup/CommandExecutor.ts +8 -8
  89. package/src/executable/setup/PluginConfigurator.ts +69 -69
  90. package/src/executable/typia.ts +55 -55
  91. package/src/factories/CommentFactory.ts +79 -79
  92. package/src/factories/MetadataTypeTagFactory.ts +1 -1
  93. package/src/factories/ProtobufFactory.ts +4 -4
  94. package/src/factories/ValueFactory.ts +12 -12
  95. package/src/factories/internal/metadata/emend_metadata_atomics.ts +45 -45
  96. package/src/factories/internal/metadata/iterate_metadata_intersection.ts +1 -1
  97. package/src/http.ts +16 -16
  98. package/src/index.ts +4 -4
  99. package/src/internal/_isUniqueItems.ts +1 -1
  100. package/src/json.ts +6 -6
  101. package/src/llm.ts +8 -8
  102. package/src/misc.ts +11 -11
  103. package/src/module.ts +5 -5
  104. package/src/programmers/FeatureProgrammer.ts +3 -3
  105. package/src/programmers/TypiaProgrammer.ts +1 -1
  106. package/src/programmers/helpers/ICheckEntry.ts +13 -13
  107. package/src/programmers/helpers/IExpressionEntry.ts +12 -12
  108. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  109. package/src/programmers/helpers/UnionExplorer.ts +1 -1
  110. package/src/programmers/helpers/UnionPredicator.ts +3 -3
  111. package/src/programmers/internal/stringify_native.ts +7 -7
  112. package/src/programmers/json/JsonApplicationProgrammer.ts +28 -28
  113. package/src/programmers/llm/LlmApplicationOfValidateProgrammer.ts +16 -2
  114. package/src/programmers/llm/LlmApplicationProgrammer.ts +51 -13
  115. package/src/programmers/llm/LlmParametersProgrammer.ts +1 -1
  116. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +1 -1
  117. package/src/protobuf.ts +9 -9
  118. package/src/schemas/llm/ILlmApplicationOfValidate.ts +2 -2
  119. package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
  120. package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
  121. package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
  122. package/src/schemas/metadata/IMetadataConstant.ts +18 -18
  123. package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
  124. package/src/schemas/metadata/IMetadataFunction.ts +8 -8
  125. package/src/schemas/metadata/IMetadataParameter.ts +9 -9
  126. package/src/schemas/metadata/IMetadataProperty.ts +9 -9
  127. package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
  128. package/src/schemas/metadata/MetadataArrayType.ts +57 -57
  129. package/src/schemas/metadata/MetadataConstant.ts +34 -34
  130. package/src/schemas/metadata/MetadataEscaped.ts +51 -51
  131. package/src/schemas/metadata/MetadataFunction.ts +49 -49
  132. package/src/schemas/metadata/MetadataTupleType.ts +67 -67
  133. package/src/tags/Constant.ts +15 -15
  134. package/src/tags/ContentMediaType.ts +10 -10
  135. package/src/tags/Default.ts +22 -22
  136. package/src/tags/ExclusiveMaximum.ts +25 -25
  137. package/src/tags/ExclusiveMinimum.ts +25 -25
  138. package/src/tags/MaxItems.ts +12 -12
  139. package/src/tags/MaxLength.ts +12 -12
  140. package/src/tags/Maximum.ts +19 -19
  141. package/src/tags/MinItems.ts +12 -12
  142. package/src/tags/MinLength.ts +12 -12
  143. package/src/tags/Minimum.ts +19 -19
  144. package/src/tags/MultipleOf.ts +21 -21
  145. package/src/tags/Pattern.ts +31 -31
  146. package/src/tags/TagBase.ts +1 -1
  147. package/src/tags/Type.ts +0 -1
  148. package/src/tags/internal/FormatCheatSheet.ts +73 -73
  149. package/src/transformers/ImportTransformer.ts +3 -3
  150. package/src/transformers/features/json/JsonValidateParseTransformer.ts +1 -1
  151. package/src/transformers/features/json/JsonValidateStringifyTransformer.ts +1 -1
  152. package/src/transformers/features/misc/MiscValidateCloneTransformer.ts +1 -1
  153. package/src/transformers/features/misc/MiscValidatePruneTransformer.ts +1 -1
  154. package/src/transformers/features/reflect/ReflectNameTransformer.ts +1 -1
  155. package/src/typings/Atomic.ts +13 -13
  156. package/src/typings/ClassProperties.ts +5 -5
  157. package/src/typings/Customizable.ts +5 -5
  158. package/src/typings/Equal.ts +18 -18
  159. package/src/typings/IsTuple.ts +9 -9
  160. package/src/typings/NativeClass.ts +23 -23
  161. package/src/typings/OmitNever.ts +3 -3
  162. package/src/typings/ProtobufAtomic.ts +19 -19
  163. package/src/typings/SpecialFields.ts +3 -3
  164. package/src/typings/ValidationPipe.ts +9 -9
  165. package/src/typings/ValueOf.ts +20 -20
  166. package/src/typings/Writable.ts +11 -11
  167. package/src/utils/ArrayUtil.ts +41 -41
  168. package/src/utils/Escaper.ts +50 -50
  169. package/src/utils/PatternUtil.ts +29 -29
  170. package/src/utils/Singleton.ts +16 -16
@@ -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/functinoal
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");
36
- await TypiaSetupWizard.setup();
37
- } else if (type === "patch") {
38
- const { TypiaPatchWizard } = await import("./TypiaPatchWizard");
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");
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/functinoal
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");
36
+ await TypiaSetupWizard.setup();
37
+ } else if (type === "patch") {
38
+ const { TypiaPatchWizard } = await import("./TypiaPatchWizard");
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");
49
+ await TypiaGenerateWizard.generate();
50
+ } else halt(USAGE);
51
+ };
52
+ main().catch((exp) => {
53
+ console.error(exp);
54
+ process.exit(-1);
55
+ });
@@ -1,79 +1,79 @@
1
- import ts from "typescript";
2
-
3
- export namespace CommentFactory {
4
- export const description = (
5
- symbol: ts.Symbol,
6
- includeTags: boolean = false,
7
- ): string | undefined => {
8
- const node = symbol.declarations?.[0];
9
- if (!node) return undefined;
10
-
11
- // FOR LEGACY TS < 5.2
12
- const [major, minor] = ts.versionMajorMinor.split(".").map(Number) as [
13
- number,
14
- number,
15
- ];
16
- if (major < 5 || (major === 5 && minor < 1)) {
17
- const content: string[] = [];
18
- const main: string = ts.displayPartsToString(
19
- symbol.getDocumentationComment(undefined),
20
- );
21
- if (main.length) {
22
- content.push(main);
23
- if (includeTags && symbol.getJsDocTags().length) content.push("");
24
- }
25
- if (includeTags)
26
- for (const tag of symbol.getJsDocTags()) {
27
- content.push(
28
- tag.text
29
- ? `@${tag.name} ${ts.displayPartsToString(tag.text)}`
30
- : `@${tag.name}`,
31
- );
32
- }
33
- return content.length
34
- ? content.map((line) => line.split("\r\n").join("\n")).join("\n")
35
- : undefined;
36
- }
37
-
38
- // NEW FEATURE OF TS 5.2
39
- const elements: readonly (ts.JSDoc | ts.JSDocTag)[] =
40
- ts.getJSDocCommentsAndTags(node);
41
- if (elements.length === 0) return undefined;
42
-
43
- const content: string[] = [];
44
- for (const comment of elements) {
45
- if (ts.isJSDoc(comment)) {
46
- const parsed: string | undefined = ts.getTextOfJSDocComment(
47
- comment.comment,
48
- );
49
- if (parsed?.length) {
50
- content.push(parsed);
51
- if (includeTags && comment.tags?.length) content.push("");
52
- }
53
- if (includeTags)
54
- for (const tag of comment.tags ?? [])
55
- content.push(parseJSDocTag(tag));
56
- } else if (includeTags) content.push(parseJSDocTag(comment));
57
- }
58
- const output: string = content
59
- .map((line) => line.split("\r\n").join("\n"))
60
- .join("\n");
61
- return output.length ? output : undefined;
62
- };
63
-
64
- export const merge = (comments: ts.SymbolDisplayPart[]): string =>
65
- comments
66
- .map((part) => part.text)
67
- .map((str) => str.split("\r\n").join("\n"))
68
- .join("");
69
- }
70
-
71
- const parseJSDocTag = (tag: ts.JSDocTag): string => {
72
- const name: string | undefined = (
73
- tag as ts.JSDocParameterTag
74
- ).name?.getText();
75
- const parsed: string | undefined = ts.getTextOfJSDocComment(tag.comment);
76
- return [`@${tag.tagName.text}`, name, parsed]
77
- .filter((str) => !!str?.length)
78
- .join(" ");
79
- };
1
+ import ts from "typescript";
2
+
3
+ export namespace CommentFactory {
4
+ export const description = (
5
+ symbol: ts.Symbol,
6
+ includeTags: boolean = false,
7
+ ): string | undefined => {
8
+ const node = symbol.declarations?.[0];
9
+ if (!node) return undefined;
10
+
11
+ // FOR LEGACY TS < 5.2
12
+ const [major, minor] = ts.versionMajorMinor.split(".").map(Number) as [
13
+ number,
14
+ number,
15
+ ];
16
+ if (major < 5 || (major === 5 && minor < 1)) {
17
+ const content: string[] = [];
18
+ const main: string = ts.displayPartsToString(
19
+ symbol.getDocumentationComment(undefined),
20
+ );
21
+ if (main.length) {
22
+ content.push(main);
23
+ if (includeTags && symbol.getJsDocTags().length) content.push("");
24
+ }
25
+ if (includeTags)
26
+ for (const tag of symbol.getJsDocTags()) {
27
+ content.push(
28
+ tag.text
29
+ ? `@${tag.name} ${ts.displayPartsToString(tag.text)}`
30
+ : `@${tag.name}`,
31
+ );
32
+ }
33
+ return content.length
34
+ ? content.map((line) => line.split("\r\n").join("\n")).join("\n")
35
+ : undefined;
36
+ }
37
+
38
+ // NEW FEATURE OF TS 5.2
39
+ const elements: readonly (ts.JSDoc | ts.JSDocTag)[] =
40
+ ts.getJSDocCommentsAndTags(node);
41
+ if (elements.length === 0) return undefined;
42
+
43
+ const content: string[] = [];
44
+ for (const comment of elements) {
45
+ if (ts.isJSDoc(comment)) {
46
+ const parsed: string | undefined = ts.getTextOfJSDocComment(
47
+ comment.comment,
48
+ );
49
+ if (parsed?.length) {
50
+ content.push(parsed);
51
+ if (includeTags && comment.tags?.length) content.push("");
52
+ }
53
+ if (includeTags)
54
+ for (const tag of comment.tags ?? [])
55
+ content.push(parseJSDocTag(tag));
56
+ } else if (includeTags) content.push(parseJSDocTag(comment));
57
+ }
58
+ const output: string = content
59
+ .map((line) => line.split("\r\n").join("\n"))
60
+ .join("\n");
61
+ return output.length ? output : undefined;
62
+ };
63
+
64
+ export const merge = (comments: ts.SymbolDisplayPart[]): string =>
65
+ comments
66
+ .map((part) => part.text)
67
+ .map((str) => str.split("\r\n").join("\n"))
68
+ .join("");
69
+ }
70
+
71
+ const parseJSDocTag = (tag: ts.JSDocTag): string => {
72
+ const name: string | undefined = (
73
+ tag as ts.JSDocParameterTag
74
+ ).name?.getText();
75
+ const parsed: string | undefined = ts.getTextOfJSDocComment(tag.comment);
76
+ return [`@${tag.tagName.text}`, name, parsed]
77
+ .filter((str) => !!str?.length)
78
+ .join(" ");
79
+ };
@@ -152,7 +152,7 @@ export namespace MetadataTypeTagFactory {
152
152
  if (tag.target !== props.type) {
153
153
  success &&= props.report({
154
154
  property: null,
155
- message: `target must constains ${props.type} type`,
155
+ message: `target must contain ${props.type} type`,
156
156
  });
157
157
  }
158
158
 
@@ -409,14 +409,14 @@ export namespace ProtobufFactory {
409
409
  );
410
410
  }
411
411
  //----
412
- // ARRRAY CASES
412
+ // ARRAY CASES
413
413
  //----
414
- // DO NOT ALLOW MULTI-DIMENTIONAL ARRAY
414
+ // DO NOT ALLOW MULTI-DIMENSIONAL ARRAY
415
415
  if (
416
416
  meta.arrays.length &&
417
417
  meta.arrays.some((array) => !!array.type.value.arrays.length)
418
418
  )
419
- noSupport("over two dimenstional array type");
419
+ noSupport("over two dimensional array type");
420
420
  // CHILD OF ARRAY TYPE MUST BE REQUIRED
421
421
  if (
422
422
  meta.arrays.length &&
@@ -494,7 +494,7 @@ export namespace ProtobufFactory {
494
494
  meta.objects[0]!.type.properties.some((p) => !!p.value.arrays.length)
495
495
  )
496
496
  noSupport("dynamic object with array value type");
497
- // UNION WITH DYNAMIC OBJECTa
497
+ // UNION WITH DYNAMIC OBJECTTa
498
498
  if (
499
499
  meta.size() > 1 &&
500
500
  meta.objects.length &&
@@ -1,12 +1,12 @@
1
- import ts from "typescript";
2
-
3
- export namespace ValueFactory {
4
- export const NULL = () => ts.factory.createNull();
5
- export const UNDEFINED = () => ts.factory.createIdentifier("undefined");
6
- export const BOOLEAN = (value: boolean) =>
7
- value ? ts.factory.createTrue() : ts.factory.createFalse();
8
- export const INPUT = (str: string = "input") =>
9
- ts.factory.createIdentifier(str);
10
- export const TYPEOF = (input: ts.Expression) =>
11
- ts.factory.createTypeOfExpression(input);
12
- }
1
+ import ts from "typescript";
2
+
3
+ export namespace ValueFactory {
4
+ export const NULL = () => ts.factory.createNull();
5
+ export const UNDEFINED = () => ts.factory.createIdentifier("undefined");
6
+ export const BOOLEAN = (value: boolean) =>
7
+ value ? ts.factory.createTrue() : ts.factory.createFalse();
8
+ export const INPUT = (str: string = "input") =>
9
+ ts.factory.createIdentifier(str);
10
+ export const TYPEOF = (input: ts.Expression) =>
11
+ ts.factory.createTypeOfExpression(input);
12
+ }
@@ -1,45 +1,45 @@
1
- import { Metadata } from "../../../schemas/metadata/Metadata";
2
- import { MetadataAtomic } from "../../../schemas/metadata/MetadataAtomic";
3
-
4
- import { ArrayUtil } from "../../../utils/ArrayUtil";
5
-
6
- export const emend_metadata_atomics = (meta: Metadata) => {
7
- // ATOMICS
8
- for (const a of meta.atomics) {
9
- if (is_not_pure(a)) continue;
10
- const index: number = meta.constants.findIndex((c) => c.type === a.type);
11
- if (index !== -1) meta.constants.splice(index, 1);
12
- }
13
-
14
- // BOOLEAN
15
- {
16
- const index: number = meta.constants.findIndex((c) => c.type === "boolean");
17
- if (index !== -1 && meta.constants[index]!.values.length === 2) {
18
- const temp = meta.constants.splice(index, 1)[0]!;
19
- ArrayUtil.take(
20
- meta.atomics,
21
- (a) => a.type === "boolean",
22
- () =>
23
- MetadataAtomic.create({
24
- type: "boolean" as const,
25
- tags: temp.values[0]!.tags ?? [],
26
- }),
27
- );
28
- }
29
- }
30
-
31
- // TEMPLATE
32
- if (meta.templates.length) {
33
- const atomic: MetadataAtomic | undefined = meta.atomics.find(
34
- (a) => a.type === "string",
35
- );
36
- if (atomic !== undefined && false === is_not_pure(atomic))
37
- meta.templates.splice(0, meta.templates.length);
38
- }
39
- };
40
-
41
- const is_not_pure = (atomic: MetadataAtomic): boolean =>
42
- atomic.tags.length !== 0 &&
43
- atomic.tags.every(
44
- (row) => row.length !== 0 && row.every((c) => !!c.validate?.length),
45
- );
1
+ import { Metadata } from "../../../schemas/metadata/Metadata";
2
+ import { MetadataAtomic } from "../../../schemas/metadata/MetadataAtomic";
3
+
4
+ import { ArrayUtil } from "../../../utils/ArrayUtil";
5
+
6
+ export const emend_metadata_atomics = (meta: Metadata) => {
7
+ // ATOMICS
8
+ for (const a of meta.atomics) {
9
+ if (is_not_pure(a)) continue;
10
+ const index: number = meta.constants.findIndex((c) => c.type === a.type);
11
+ if (index !== -1) meta.constants.splice(index, 1);
12
+ }
13
+
14
+ // BOOLEAN
15
+ {
16
+ const index: number = meta.constants.findIndex((c) => c.type === "boolean");
17
+ if (index !== -1 && meta.constants[index]!.values.length === 2) {
18
+ const temp = meta.constants.splice(index, 1)[0]!;
19
+ ArrayUtil.take(
20
+ meta.atomics,
21
+ (a) => a.type === "boolean",
22
+ () =>
23
+ MetadataAtomic.create({
24
+ type: "boolean" as const,
25
+ tags: temp.values[0]!.tags ?? [],
26
+ }),
27
+ );
28
+ }
29
+ }
30
+
31
+ // TEMPLATE
32
+ if (meta.templates.length) {
33
+ const atomic: MetadataAtomic | undefined = meta.atomics.find(
34
+ (a) => a.type === "string",
35
+ );
36
+ if (atomic !== undefined && false === is_not_pure(atomic))
37
+ meta.templates.splice(0, meta.templates.length);
38
+ }
39
+ };
40
+
41
+ const is_not_pure = (atomic: MetadataAtomic): boolean =>
42
+ atomic.tags.length !== 0 &&
43
+ atomic.tags.every(
44
+ (row) => row.length !== 0 && row.every((c) => !!c.validate?.length),
45
+ );
@@ -16,7 +16,7 @@ export const iterate_metadata_intersection = (
16
16
  if (props.intersected === true) return false;
17
17
  else if (props.type.isIntersection() === false) return false;
18
18
 
19
- // COSTRUCT FAKE METADATA LIST
19
+ // CONSTRUCT FAKE METADATA LIST
20
20
  const commit: MetadataCollection = props.collection.clone();
21
21
  props.collection["options"] = undefined;
22
22
 
package/src/http.ts CHANGED
@@ -25,7 +25,7 @@ import { TypeGuardError } from "./TypeGuardError";
25
25
  *
26
26
  * By the way, as `FormData` is not enough to express complex data structures,
27
27
  * `typia.http.formData()` function has some limitations. If target type `T` is
28
- * not following those restrictions, compilation errors would be occured.
28
+ * not following those restrictions, compilation errors would be occurred.
29
29
  *
30
30
  * 1. Type `T` must be an object type
31
31
  * 2. Do not allow dynamic property
@@ -34,7 +34,7 @@ import { TypeGuardError } from "./TypeGuardError";
34
34
  *
35
35
  * Also, `typia.http.formData()` function does not perform validation about the
36
36
  * decoded value. Therefore, if you can't sure that input data is following the
37
- * `T` type, it would better to call one of below functions intead.
37
+ * `T` type, it would better to call one of below functions instead.
38
38
  *
39
39
  * @template T Expected type of decoded value
40
40
  * @param input FormData instance
@@ -66,7 +66,7 @@ export function formData(): never {
66
66
  *
67
67
  * By the way, as `FormData` is not enough to express complex data structures,
68
68
  * `typia.http.assertFormData()` function has some limitations. If target type `T`
69
- * is not following those restrictions, compilation errors would be occured.
69
+ * is not following those restrictions, compilation errors would be occurred.
70
70
  *
71
71
  * 1. Type `T` must be an object type
72
72
  * 2. Do not allow dynamic property
@@ -106,7 +106,7 @@ export function assertFormData(): never {
106
106
  *
107
107
  * By the way, as `FormData` is not enough to express complex data structures,
108
108
  * `typia.http.isFormData()` function has some limitations. If target type `T` is
109
- * not following those restrictions, compilation errors would be occured.
109
+ * not following those restrictions, compilation errors would be occurred.
110
110
  *
111
111
  * 1. Type `T` must be an object type
112
112
  * 2. Do not allow dynamic property
@@ -146,7 +146,7 @@ export function isFormData(): never {
146
146
  *
147
147
  * By the way, as `FormData` is not enough to express complex data structures,
148
148
  * `typia.http.validateFormData()` function has some limitations. If target type
149
- * `T` is not following those restrictions, compilation errors would be occured.
149
+ * `T` is not following those restrictions, compilation errors would be occurred.
150
150
  *
151
151
  * 1. Type `T` must be an object type
152
152
  * 2. Do not allow dynamic property
@@ -183,7 +183,7 @@ export function validateFormData(): never {
183
183
  *
184
184
  * By the way, as URL query is not enough to express complex data structures,
185
185
  * `typia.http.query()` function has some limitations. If target type `T` is not
186
- * following those restrictions, compilation errors would be occured.
186
+ * following those restrictions, compilation errors would be occurred.
187
187
  *
188
188
  * 1. Type `T` must be an object type
189
189
  * 2. Do not allow dynamic property
@@ -192,7 +192,7 @@ export function validateFormData(): never {
192
192
  *
193
193
  * Also, `typia.http.query()` function does not perform validation about the decoded
194
194
  * value. Therefore, if you can't sure that input data is following the `T` type,
195
- * it would better to call one of below functions intead.
195
+ * it would better to call one of below functions instead.
196
196
  *
197
197
  * - {@link assertQuery}
198
198
  * - {@link isQuery}
@@ -230,7 +230,7 @@ export function query(): never {
230
230
  *
231
231
  * By the way, as URL query is not enough to express complex data structures,
232
232
  * `typia.http.assertQuery()` function has some limitations. If target type `T` is
233
- * notfollowing those restrictions, compilation errors would be occured.
233
+ * notfollowing those restrictions, compilation errors would be occurred.
234
234
  *
235
235
  * 1. Type `T` must be an object type
236
236
  * 2. Do not allow dynamic property
@@ -270,7 +270,7 @@ export function assertQuery(): never {
270
270
  *
271
271
  * By the way, as URL query is not enough to express complex data structures,
272
272
  * `typia.http.isQuery()` function has some limitations. If target type `T` is
273
- * notfollowing those restrictions, compilation errors would be occured.
273
+ * notfollowing those restrictions, compilation errors would be occurred.
274
274
  *
275
275
  * 1. Type `T` must be an object type
276
276
  * 2. Do not allow dynamic property
@@ -309,7 +309,7 @@ export function isQuery(): never {
309
309
  *
310
310
  * By the way, as URL query is not enough to express complex data structures,
311
311
  * `typia.http.validateQuery()` function has some limitations. If target type `T` is
312
- * notfollowing those restrictions, compilation errors would be occured.
312
+ * notfollowing those restrictions, compilation errors would be occurred.
313
313
  *
314
314
  * 1. Type `T` must be an object type
315
315
  * 2. Do not allow dynamic property
@@ -345,7 +345,7 @@ export function validateQuery(): never {
345
345
  *
346
346
  * By the way, as HTTP headers are not enough to express complex data structures,
347
347
  * `typia.http.headers()` function has some limitations. If target type `T` is not
348
- * following those restrictions, compilation errors would be occured.
348
+ * following those restrictions, compilation errors would be occurred.
349
349
  *
350
350
  * 1. Type `T` must be an object type
351
351
  * 2. Do not allow dynamic property
@@ -376,7 +376,7 @@ export function validateQuery(): never {
376
376
  *
377
377
  * Also, `typia.http.headers()` function does not perform validation about the decoded
378
378
  * value. Therefore, if you can't sure that input data is following the `T` type,
379
- * it would better to call one of below functions intead.
379
+ * it would better to call one of below functions instead.
380
380
  *
381
381
  * - {@link assertHeaders}
382
382
  * - {@link isHeaders}
@@ -414,7 +414,7 @@ export function headers(): never {
414
414
  *
415
415
  * By the way, as HTTP headers are not enough to express complex data structures,
416
416
  * `typia.http.headers()` function has some limitations. If target type `T` is not
417
- * following those restrictions, compilation errors would be occured.
417
+ * following those restrictions, compilation errors would be occurred.
418
418
  *
419
419
  * 1. Type `T` must be an object type
420
420
  * 2. Do not allow dynamic property
@@ -478,7 +478,7 @@ export function assertHeaders(): never {
478
478
  *
479
479
  * By the way, as HTTP headers are not enough to express complex data structures,
480
480
  * `typia.http.headers()` function has some limitations. If target type `T` is not
481
- * following those restrictions, compilation errors would be occured.
481
+ * following those restrictions, compilation errors would be occurred.
482
482
  *
483
483
  * 1. Type `T` must be an object type
484
484
  * 2. Do not allow dynamic property
@@ -539,7 +539,7 @@ export function isHeaders(): never {
539
539
  *
540
540
  * By the way, as HTTP headers are not enough to express complex data structures,
541
541
  * `typia.http.headers()` function has some limitations. If target type `T` is not
542
- * following those restrictions, compilation errors would be occured.
542
+ * following those restrictions, compilation errors would be occurred.
543
543
  *
544
544
  * 1. Type `T` must be an object type
545
545
  * 2. Do not allow dynamic property
@@ -592,7 +592,7 @@ export function validateHeaders(): never {
592
592
  * URL path parameter decoder.
593
593
  *
594
594
  * `typia.http.parameter()` is a function decoding a path parameter, with automatic
595
- * type casting to the expected type. When type `T` has beeen defined as `boolean` or
595
+ * type casting to the expected type. When type `T` has been defined as `boolean` or
596
596
  * `number` type, `typia.http.parameter()` will cast the value to the expected type.
597
597
  *
598
598
  * Also, `typia.http.parameter()` performs type assertion to the decoded value by
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as typia from "./module";
2
-
3
- export default typia;
4
- export * from "./module";
1
+ import * as typia from "./module";
2
+
3
+ export default typia;
4
+ export * from "./module";
@@ -1,5 +1,5 @@
1
1
  export const _isUniqueItems = (elements: any[]): boolean => {
2
- // EMTPY OR ONLY ONE
2
+ // EMPTY OR ONLY ONE
3
3
  if (elements.length < 2) return true;
4
4
 
5
5
  // SHALLOW COMPARISON
package/src/json.ts CHANGED
@@ -174,7 +174,7 @@ export function application(): never {
174
174
  * Safe `JSON.parse()` function with type assertion.
175
175
  *
176
176
  * `typia.json.assertParse()` is a combination function of `JSON.parse()` and
177
- * {@link assert}. Therefore, it convers a JSON (JavaScript Object Notation) string
177
+ * {@link assert}. Therefore, it converts a JSON (JavaScript Object Notation) string
178
178
  * to a `T` typed instance with type assertion.
179
179
  *
180
180
  * In such reason, when parsed JSON string value is not matched with the type `T`, it
@@ -197,7 +197,7 @@ export function assertParse(
197
197
  * Safe `JSON.parse()` function with type assertion.
198
198
  *
199
199
  * `typia.json.assertParse()` is a combination function of `JSON.parse()` and
200
- * {@link assert}. Therefore, it convers a JSON (JavaScript Object Notation) string
200
+ * {@link assert}. Therefore, it converts a JSON (JavaScript Object Notation) string
201
201
  * to a `T` typed instance with type assertion.
202
202
  *
203
203
  * In such reason, when parsed JSON string value is not matched with the type `T`,
@@ -230,7 +230,7 @@ export function assertParse<T>(): Primitive<T> {
230
230
  * Safe `JSON.parse()` function with type checking.
231
231
  *
232
232
  * `typia.json.isParse()` is a combination function of `JSON.parse()` and {@link is}.
233
- * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
233
+ * Therefore, it converts a JSON (JavaScript Object Notation) string to a `T` typed
234
234
  * instance with type checking.
235
235
  *
236
236
  * In such reason, when parsed JSON string value is not matched with the type `T`, it
@@ -249,7 +249,7 @@ export function isParse(input: string): never;
249
249
  * Safe `JSON.parse()` function with type checking.
250
250
  *
251
251
  * `typia.json.isParse()` is a combination function of `JSON.parse()` and {@link is}.
252
- * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
252
+ * Therefore, it converts a JSON (JavaScript Object Notation) string to a `T` typed
253
253
  * instance with type checking.
254
254
  *
255
255
  * In such reason, when parsed JSON string value is not matched with the type `T`, it
@@ -277,7 +277,7 @@ export function isParse<T>(): Primitive<T> | null {
277
277
  * Safe `JSON.parse()` function with detailed type validation.
278
278
  *
279
279
  * `typia.json.validateParse()` is a combination function of `JSON.parse()` and
280
- * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
280
+ * {@link validate}. Therefore, it converts a JSON (JavaScript Object Notation) string
281
281
  * to a `T` typed instance with detailed type validation.
282
282
  *
283
283
  * In such reason, when parsed JSON string value is not matched with the type `T`, it
@@ -297,7 +297,7 @@ export function validateParse(input: string): never;
297
297
  * Safe `JSON.parse()` function with detailed type validation.
298
298
  *
299
299
  * `typia.json.validateParse()` is a combination function of `JSON.parse()` and
300
- * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
300
+ * {@link validate}. Therefore, it converts a JSON (JavaScript Object Notation) string
301
301
  * to a `T` typed instance with detailed type validation.
302
302
  *
303
303
  * In such reason, when parsed JSON string value is not matched with the type `T`, it