typia 7.6.0-dev.20241229 → 7.7.0-dev.20250130
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.
- package/lib/TypeGuardError.mjs +26 -0
- package/lib/TypeGuardError.mjs.map +1 -0
- package/lib/executable/setup/PluginConfigurator.js +3 -3
- package/lib/executable/typia.js +15 -15
- package/lib/functional.mjs +120 -0
- package/lib/functional.mjs.map +1 -0
- package/lib/http.d.ts +15 -15
- package/lib/http.mjs +165 -0
- package/lib/http.mjs.map +1 -0
- package/lib/index.mjs +27 -1142
- package/lib/index.mjs.map +1 -1
- package/lib/json.mjs +105 -0
- package/lib/json.mjs.map +1 -0
- package/lib/llm.mjs +33 -0
- package/lib/llm.mjs.map +1 -0
- package/lib/misc.mjs +111 -0
- package/lib/misc.mjs.map +1 -0
- package/lib/module.d.ts +4 -4
- package/lib/module.mjs +139 -0
- package/lib/module.mjs.map +1 -0
- package/lib/notations.mjs +153 -0
- package/lib/notations.mjs.map +1 -0
- package/lib/programmers/json/JsonApplicationProgrammer.d.ts +12 -0
- package/lib/programmers/json/JsonApplicationProgrammer.js +22 -22
- package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationOfValidateProgrammer.js +15 -7
- package/lib/programmers/llm/LlmApplicationOfValidateProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.js +39 -15
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/protobuf.d.ts +9 -9
- package/lib/protobuf.mjs +111 -0
- package/lib/protobuf.mjs.map +1 -0
- package/lib/reflect.mjs +18 -0
- package/lib/reflect.mjs.map +1 -0
- package/lib/schemas/llm/ILlmApplicationOfValidate.mjs +6 -0
- package/lib/schemas/llm/ILlmApplicationOfValidate.mjs.map +1 -0
- package/lib/schemas/llm/ILlmFunctionOfValidate.mjs +6 -0
- package/lib/schemas/llm/ILlmFunctionOfValidate.mjs.map +1 -0
- package/lib/tags/TagBase.d.ts +1 -1
- package/lib/tags/Type.d.ts +0 -1
- package/lib/tags/index.mjs +2 -0
- package/lib/tags/index.mjs.map +1 -0
- package/package.json +10 -8
- package/src/AssertionGuard.ts +1 -1
- package/src/CamelCase.ts +75 -75
- package/src/PascalCase.ts +71 -71
- package/src/Primitive.ts +92 -92
- package/src/Resolved.ts +74 -74
- package/src/SnakeCase.ts +126 -126
- package/src/TypeGuardError.ts +37 -37
- package/src/executable/setup/CommandExecutor.ts +8 -8
- package/src/executable/setup/PluginConfigurator.ts +69 -69
- package/src/executable/typia.ts +55 -55
- package/src/factories/CommentFactory.ts +79 -79
- package/src/factories/ValueFactory.ts +12 -12
- package/src/factories/internal/metadata/emend_metadata_atomics.ts +45 -45
- package/src/http.ts +15 -15
- package/src/index.ts +4 -4
- package/src/module.ts +4 -4
- package/src/programmers/helpers/ICheckEntry.ts +13 -13
- package/src/programmers/helpers/IExpressionEntry.ts +12 -12
- package/src/programmers/helpers/ProtobufWire.ts +34 -34
- package/src/programmers/internal/stringify_native.ts +7 -7
- package/src/programmers/json/JsonApplicationProgrammer.ts +27 -27
- package/src/programmers/llm/LlmApplicationOfValidateProgrammer.ts +16 -2
- package/src/programmers/llm/LlmApplicationProgrammer.ts +50 -12
- package/src/protobuf.ts +9 -9
- package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
- package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
- package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
- package/src/schemas/metadata/IMetadataConstant.ts +18 -18
- package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
- package/src/schemas/metadata/IMetadataFunction.ts +8 -8
- package/src/schemas/metadata/IMetadataParameter.ts +9 -9
- package/src/schemas/metadata/IMetadataProperty.ts +9 -9
- package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
- package/src/schemas/metadata/MetadataArrayType.ts +57 -57
- package/src/schemas/metadata/MetadataConstant.ts +34 -34
- package/src/schemas/metadata/MetadataEscaped.ts +51 -51
- package/src/schemas/metadata/MetadataFunction.ts +49 -49
- package/src/schemas/metadata/MetadataTupleType.ts +67 -67
- package/src/tags/Constant.ts +15 -15
- package/src/tags/ContentMediaType.ts +10 -10
- package/src/tags/Default.ts +22 -22
- package/src/tags/ExclusiveMaximum.ts +25 -25
- package/src/tags/ExclusiveMinimum.ts +25 -25
- package/src/tags/MaxItems.ts +12 -12
- package/src/tags/MaxLength.ts +12 -12
- package/src/tags/Maximum.ts +19 -19
- package/src/tags/MinItems.ts +12 -12
- package/src/tags/MinLength.ts +12 -12
- package/src/tags/Minimum.ts +19 -19
- package/src/tags/MultipleOf.ts +21 -21
- package/src/tags/Pattern.ts +31 -31
- package/src/tags/TagBase.ts +1 -1
- package/src/tags/Type.ts +0 -1
- package/src/tags/internal/FormatCheatSheet.ts +73 -73
- package/src/typings/Atomic.ts +13 -13
- package/src/typings/ClassProperties.ts +5 -5
- package/src/typings/Customizable.ts +5 -5
- package/src/typings/Equal.ts +18 -18
- package/src/typings/IsTuple.ts +9 -9
- package/src/typings/NativeClass.ts +23 -23
- package/src/typings/OmitNever.ts +3 -3
- package/src/typings/ProtobufAtomic.ts +19 -19
- package/src/typings/SpecialFields.ts +3 -3
- package/src/typings/ValidationPipe.ts +9 -9
- package/src/typings/ValueOf.ts +20 -20
- package/src/typings/Writable.ts +11 -11
- package/src/utils/ArrayUtil.ts +41 -41
- package/src/utils/Escaper.ts +50 -50
- package/src/utils/PatternUtil.ts +29 -29
- package/src/utils/Singleton.ts +16 -16
|
@@ -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
|
+
};
|
|
@@ -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
|
+
);
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
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";
|
package/src/module.ts
CHANGED
|
@@ -630,7 +630,7 @@ export function createAssert<T>(): (input: unknown) => T {
|
|
|
630
630
|
* // MUST DECLARE THE VARIABLE TYPE
|
|
631
631
|
* const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
|
|
632
632
|
*
|
|
633
|
-
* // IF NOT, COMPILATION ERROR BE
|
|
633
|
+
* // IF NOT, COMPILATION ERROR BE OCCURRED
|
|
634
634
|
* const func = typia.createAssertGuard<number>();
|
|
635
635
|
* ```
|
|
636
636
|
*
|
|
@@ -659,7 +659,7 @@ export function createAssertGuard(
|
|
|
659
659
|
* // MUST DECLARE THE VARIABLE TYPE
|
|
660
660
|
* const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
|
|
661
661
|
*
|
|
662
|
-
* // IF NOT, COMPILATION ERROR BE
|
|
662
|
+
* // IF NOT, COMPILATION ERROR BE OCCURRED
|
|
663
663
|
* const func = typia.createAssertGuard<number>();
|
|
664
664
|
* ```
|
|
665
665
|
*
|
|
@@ -784,7 +784,7 @@ export function createAssertEquals<T>(): (input: unknown) => T {
|
|
|
784
784
|
* // MUST DECLARE THE VARIABLE TYPE
|
|
785
785
|
* const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
|
|
786
786
|
*
|
|
787
|
-
* // IF NOT, COMPILATION ERROR BE
|
|
787
|
+
* // IF NOT, COMPILATION ERROR BE OCCURRED
|
|
788
788
|
* const func = typia.createAssertGuardEquals<number>();
|
|
789
789
|
* ```
|
|
790
790
|
*
|
|
@@ -813,7 +813,7 @@ export function createAssertGuardEquals(
|
|
|
813
813
|
* // MUST DECLARE THE VARIABLE TYPE
|
|
814
814
|
* const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
|
|
815
815
|
*
|
|
816
|
-
* // IF NOT, COMPILATION ERROR BE
|
|
816
|
+
* // IF NOT, COMPILATION ERROR BE OCCURRED
|
|
817
817
|
* const func = typia.createAssertGuardEquals<number>();
|
|
818
818
|
* ```
|
|
819
819
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
export interface ICheckEntry {
|
|
4
|
-
expected: string;
|
|
5
|
-
expression: ts.Expression | null;
|
|
6
|
-
conditions: ICheckEntry.ICondition[][];
|
|
7
|
-
}
|
|
8
|
-
export namespace ICheckEntry {
|
|
9
|
-
export interface ICondition {
|
|
10
|
-
expected: string;
|
|
11
|
-
expression: ts.Expression;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
export interface ICheckEntry {
|
|
4
|
+
expected: string;
|
|
5
|
+
expression: ts.Expression | null;
|
|
6
|
+
conditions: ICheckEntry.ICondition[][];
|
|
7
|
+
}
|
|
8
|
+
export namespace ICheckEntry {
|
|
9
|
+
export interface ICondition {
|
|
10
|
+
expected: string;
|
|
11
|
+
expression: ts.Expression;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
4
|
-
|
|
5
|
-
export interface IExpressionEntry<
|
|
6
|
-
Expression extends ts.ConciseBody = ts.ConciseBody,
|
|
7
|
-
> {
|
|
8
|
-
input: ts.Expression;
|
|
9
|
-
key: Metadata;
|
|
10
|
-
meta: Metadata;
|
|
11
|
-
expression: Expression;
|
|
12
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
4
|
+
|
|
5
|
+
export interface IExpressionEntry<
|
|
6
|
+
Expression extends ts.ConciseBody = ts.ConciseBody,
|
|
7
|
+
> {
|
|
8
|
+
input: ts.Expression;
|
|
9
|
+
key: Metadata;
|
|
10
|
+
meta: Metadata;
|
|
11
|
+
expression: Expression;
|
|
12
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export const enum ProtobufWire {
|
|
2
|
-
/**
|
|
3
|
-
* - integers
|
|
4
|
-
* - bool
|
|
5
|
-
* - enum
|
|
6
|
-
*/
|
|
7
|
-
VARIANT = 0,
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* - fixed64
|
|
11
|
-
* - sfixed64
|
|
12
|
-
* - double
|
|
13
|
-
*/
|
|
14
|
-
I64 = 1,
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* - string
|
|
18
|
-
* - bytes
|
|
19
|
-
* - mebedded messages
|
|
20
|
-
* - packed repeated fields
|
|
21
|
-
*/
|
|
22
|
-
LEN = 2,
|
|
23
|
-
|
|
24
|
-
START_GROUP = 3,
|
|
25
|
-
|
|
26
|
-
END_GROUP = 4,
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* - fixed
|
|
30
|
-
* - sfixed32
|
|
31
|
-
* - float
|
|
32
|
-
*/
|
|
33
|
-
I32 = 5,
|
|
34
|
-
}
|
|
1
|
+
export const enum ProtobufWire {
|
|
2
|
+
/**
|
|
3
|
+
* - integers
|
|
4
|
+
* - bool
|
|
5
|
+
* - enum
|
|
6
|
+
*/
|
|
7
|
+
VARIANT = 0,
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* - fixed64
|
|
11
|
+
* - sfixed64
|
|
12
|
+
* - double
|
|
13
|
+
*/
|
|
14
|
+
I64 = 1,
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* - string
|
|
18
|
+
* - bytes
|
|
19
|
+
* - mebedded messages
|
|
20
|
+
* - packed repeated fields
|
|
21
|
+
*/
|
|
22
|
+
LEN = 2,
|
|
23
|
+
|
|
24
|
+
START_GROUP = 3,
|
|
25
|
+
|
|
26
|
+
END_GROUP = 4,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* - fixed
|
|
30
|
+
* - sfixed32
|
|
31
|
+
* - float
|
|
32
|
+
*/
|
|
33
|
+
I32 = 5,
|
|
34
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export const stringify_native = (): ts.Expression =>
|
|
7
|
-
ts.factory.createStringLiteral("{}");
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export const stringify_native = (): ts.Expression =>
|
|
7
|
+
ts.factory.createStringLiteral("{}");
|
|
@@ -130,6 +130,33 @@ export namespace JsonApplicationProgrammer {
|
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
+
export const writeDescription = <Kind extends "summary" | "title">(props: {
|
|
134
|
+
description: string | null;
|
|
135
|
+
jsDocTags: IJsDocTagInfo[];
|
|
136
|
+
kind: Kind;
|
|
137
|
+
}): Kind extends "summary"
|
|
138
|
+
? { summary?: string; description?: string }
|
|
139
|
+
: { title?: string; description?: string } => {
|
|
140
|
+
const title: string | undefined = (() => {
|
|
141
|
+
const [explicit] = getJsDocTexts({
|
|
142
|
+
jsDocTags: props.jsDocTags,
|
|
143
|
+
name: props.kind,
|
|
144
|
+
});
|
|
145
|
+
if (explicit?.length) return explicit;
|
|
146
|
+
else if (!props.description?.length) return undefined;
|
|
147
|
+
|
|
148
|
+
const index: number = props.description.indexOf("\n");
|
|
149
|
+
const top: string = (
|
|
150
|
+
index === -1 ? props.description : props.description.substring(0, index)
|
|
151
|
+
).trim();
|
|
152
|
+
return top.endsWith(".") ? top.substring(0, top.length - 1) : undefined;
|
|
153
|
+
})();
|
|
154
|
+
return {
|
|
155
|
+
[props.kind]: title,
|
|
156
|
+
description: props.description?.length ? props.description : undefined,
|
|
157
|
+
} as any;
|
|
158
|
+
};
|
|
159
|
+
|
|
133
160
|
const collectFunction = <Version extends "3.0" | "3.1">(props: {
|
|
134
161
|
version: Version;
|
|
135
162
|
name: string;
|
|
@@ -217,33 +244,6 @@ export namespace JsonApplicationProgrammer {
|
|
|
217
244
|
};
|
|
218
245
|
}
|
|
219
246
|
|
|
220
|
-
const writeDescription = <Kind extends "summary" | "title">(props: {
|
|
221
|
-
description: string | null;
|
|
222
|
-
jsDocTags: IJsDocTagInfo[];
|
|
223
|
-
kind: Kind;
|
|
224
|
-
}): Kind extends "summary"
|
|
225
|
-
? { summary?: string; description?: string }
|
|
226
|
-
: { title?: string; description?: string } => {
|
|
227
|
-
const title: string | undefined = (() => {
|
|
228
|
-
const [explicit] = getJsDocTexts({
|
|
229
|
-
jsDocTags: props.jsDocTags,
|
|
230
|
-
name: props.kind,
|
|
231
|
-
});
|
|
232
|
-
if (explicit?.length) return explicit;
|
|
233
|
-
else if (!props.description?.length) return undefined;
|
|
234
|
-
|
|
235
|
-
const index: number = props.description.indexOf("\n");
|
|
236
|
-
const top: string = (
|
|
237
|
-
index === -1 ? props.description : props.description.substring(0, index)
|
|
238
|
-
).trim();
|
|
239
|
-
return top.endsWith(".") ? top.substring(0, top.length - 1) : undefined;
|
|
240
|
-
})();
|
|
241
|
-
return {
|
|
242
|
-
[props.kind]: title,
|
|
243
|
-
description: props.description?.length ? props.description : undefined,
|
|
244
|
-
} as any;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
247
|
const writeDescriptionFromJsDocTag = (props: {
|
|
248
248
|
jsDocTags: IJsDocTagInfo[];
|
|
249
249
|
name: string;
|