typia 7.0.0-dev.20241020 → 7.0.0-dev.20241021
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/programmers/ImportProgrammer.d.ts +6 -0
- package/lib/programmers/ImportProgrammer.js +9 -8
- package/lib/programmers/ImportProgrammer.js.map +1 -1
- package/lib/transformers/FileTransformer.js +3 -1
- package/lib/transformers/FileTransformer.js.map +1 -1
- package/package.json +1 -1
- package/src/factories/internal/metadata/MetadataHelper.ts +21 -21
- package/src/programmers/ImportProgrammer.ts +16 -8
- package/src/schemas/metadata/IMetadataConstantValue.ts +11 -11
- package/src/schemas/metadata/MetadataConstantValue.ts +62 -62
- package/src/schemas/metadata/MetadataProperty.ts +59 -59
- package/src/tags/index.ts +21 -21
- package/src/transformers/FileTransformer.ts +3 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
export declare class ImportProgrammer {
|
|
3
3
|
private readonly assets_;
|
|
4
|
+
private readonly options_;
|
|
5
|
+
constructor(options?: Partial<ImportProgrammer.IOptions>);
|
|
4
6
|
default(props: ImportProgrammer.IDefault): ts.Identifier;
|
|
5
7
|
instance(props: ImportProgrammer.IInstance): ts.Identifier;
|
|
6
8
|
namespace(props: ImportProgrammer.INamespace): ts.Identifier;
|
|
@@ -9,9 +11,13 @@ export declare class ImportProgrammer {
|
|
|
9
11
|
name: string | ts.EntityName;
|
|
10
12
|
arguments?: ts.TypeNode[];
|
|
11
13
|
}): ts.ImportTypeNode;
|
|
14
|
+
private alias;
|
|
12
15
|
toStatements(): ts.ImportDeclaration[];
|
|
13
16
|
}
|
|
14
17
|
export declare namespace ImportProgrammer {
|
|
18
|
+
interface IOptions {
|
|
19
|
+
internalPrefix: string;
|
|
20
|
+
}
|
|
15
21
|
interface IDefault {
|
|
16
22
|
file: string;
|
|
17
23
|
name: string;
|
|
@@ -43,8 +43,12 @@ exports.ImportProgrammer = void 0;
|
|
|
43
43
|
var typescript_1 = __importDefault(require("typescript"));
|
|
44
44
|
var MapUtil_1 = require("../utils/MapUtil");
|
|
45
45
|
var ImportProgrammer = /** @class */ (function () {
|
|
46
|
-
function ImportProgrammer() {
|
|
46
|
+
function ImportProgrammer(options) {
|
|
47
|
+
var _a;
|
|
47
48
|
this.assets_ = new Map();
|
|
49
|
+
this.options_ = {
|
|
50
|
+
internalPrefix: (_a = options === null || options === void 0 ? void 0 : options.internalPrefix) !== null && _a !== void 0 ? _a : "",
|
|
51
|
+
};
|
|
48
52
|
}
|
|
49
53
|
/* -----------------------------------------------------------
|
|
50
54
|
ENROLLMENTS
|
|
@@ -84,14 +88,9 @@ var ImportProgrammer = /** @class */ (function () {
|
|
|
84
88
|
ImportProgrammer.prototype.internal = function (name) {
|
|
85
89
|
if (name.startsWith("$") === false)
|
|
86
90
|
name = "$".concat(name);
|
|
87
|
-
this.namespace({
|
|
88
|
-
file: "typia/lib/internal/".concat(name, ".js"),
|
|
89
|
-
name: alias(name),
|
|
90
|
-
type: false,
|
|
91
|
-
});
|
|
92
91
|
return typescript_1.default.factory.createPropertyAccessExpression(this.namespace({
|
|
93
92
|
file: "typia/lib/internal/".concat(name, ".js"),
|
|
94
|
-
name: alias(name),
|
|
93
|
+
name: this.alias(name),
|
|
95
94
|
type: false,
|
|
96
95
|
}), name);
|
|
97
96
|
};
|
|
@@ -117,6 +116,9 @@ var ImportProgrammer = /** @class */ (function () {
|
|
|
117
116
|
instances: new Map(),
|
|
118
117
|
}); });
|
|
119
118
|
};
|
|
119
|
+
ImportProgrammer.prototype.alias = function (name) {
|
|
120
|
+
return "__".concat(this.options_.internalPrefix).concat(name);
|
|
121
|
+
};
|
|
120
122
|
/* -----------------------------------------------------------
|
|
121
123
|
PROGRAM STATEMENTS
|
|
122
124
|
----------------------------------------------------------- */
|
|
@@ -151,5 +153,4 @@ var ImportProgrammer = /** @class */ (function () {
|
|
|
151
153
|
return ImportProgrammer;
|
|
152
154
|
}());
|
|
153
155
|
exports.ImportProgrammer = ImportProgrammer;
|
|
154
|
-
var alias = function (str) { return "__".concat(str); };
|
|
155
156
|
//# sourceMappingURL=ImportProgrammer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportProgrammer.js","sourceRoot":"","sources":["../../src/programmers/ImportProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAE5B,4CAA2C;AAE3C;
|
|
1
|
+
{"version":3,"file":"ImportProgrammer.js","sourceRoot":"","sources":["../../src/programmers/ImportProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAE5B,4CAA2C;AAE3C;IAIE,0BAAmB,OAA4C;;QAH9C,YAAO,GAAwB,IAAI,GAAG,EAAE,CAAC;QAIxD,IAAI,CAAC,QAAQ,GAAG;YACd,cAAc,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,mCAAI,EAAE;SAC9C,CAAC;IACJ,CAAC;IAED;;kEAE8D;IACvD,kCAAO,GAAd,UAAe,KAAgC;;;QAC7C,IAAM,KAAK,GAAW,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5C,MAAA,KAAK,CAAC,OAAO,oCAAb,KAAK,CAAC,OAAO,GAAK,KAAK,EAAC;QACxB,MAAA,KAAK,CAAC,OAAO,EAAC,IAAI,QAAJ,IAAI,GAAK,KAAK,CAAC,IAAI,EAAC;QAClC,OAAO,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IAEM,mCAAQ,GAAf,UAAgB,KAAiC;;QAC/C,IAAM,KAAK,GAAW,MAAA,KAAK,CAAC,KAAK,mCAAI,KAAK,CAAC,IAAI,CAAC;QAChD,IAAM,KAAK,GAAW,IAAI,CAAC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E,GAAG,CAAC,UAAC,GAAG;;4BACpC,OAAA,oBAAE,CAAC,OAAO,CAAC,qBAAqB,CAC9B,GAAG,CAAC,IAAI,EACR,SAAS,EACT,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAA,GAAG,CAAC,KAAK,mCAAI,GAAG,CAAC,IAAI,CAAC,CACnD,CAAA;yBAAA,CACF,CACF;wBACH,CAAC,CAAC,SAAS,CACd,EACD,oBAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,EAC1C,SAAS,CACV,CACF,CAAC;YACN,CAAC;;;;;;;;;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IACH,uBAAC;AAAD,CAAC,AA7JD,IA6JC;AA7JY,4CAAgB"}
|
|
@@ -51,7 +51,9 @@ var FileTransformer;
|
|
|
51
51
|
return function (file) {
|
|
52
52
|
if (file.isDeclarationFile)
|
|
53
53
|
return file;
|
|
54
|
-
var importer = new ImportProgrammer_1.ImportProgrammer(
|
|
54
|
+
var importer = new ImportProgrammer_1.ImportProgrammer({
|
|
55
|
+
internalPrefix: "typia_transform_",
|
|
56
|
+
});
|
|
55
57
|
var context = __assign(__assign({}, environments), { transformer: transformer, importer: importer });
|
|
56
58
|
checkJsDocParsingMode.get(context, file);
|
|
57
59
|
file = typescript_1.default.visitEachChild(file, function (node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileTransformer.js","sourceRoot":"","sources":["../../src/transformers/FileTransformer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAE5B,oEAAmE;AAEnE,gDAA+C;AAG/C,qDAAoD;AAGpD,IAAiB,eAAe,
|
|
1
|
+
{"version":3,"file":"FileTransformer.js","sourceRoot":"","sources":["../../src/transformers/FileTransformer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4B;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;YAC/B,IAAI,EAAE,eAAsB;YAC5B,GAAG,EAAE,kBAAkB;YACvB,QAAQ,EAAE,oBAAE,CAAC,kBAAkB,CAAC,OAAO;YACvC,OAAO,EAAE;gBACP,+DAA2D;gBAC3D,EAAE;gBACF,0OAAgO;gBAChO,EAAE;gBACF,oJAAgJ;gBAChJ,EAAE;gBACF,mEAAmE;aACpE,CAAC,IAAI,CAAC,IAAI,CAAC;SACb,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC,CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Metadata } from "../../../schemas/metadata/Metadata";
|
|
2
|
-
import { MetadataConstant } from "../../../schemas/metadata/MetadataConstant";
|
|
3
|
-
import { MetadataConstantValue } from "../../../schemas/metadata/MetadataConstantValue";
|
|
4
|
-
|
|
5
|
-
export namespace MetadataHelper {
|
|
6
|
-
export const literal_to_metadata = (key: string): Metadata => {
|
|
7
|
-
const metadata: Metadata = Metadata.initialize();
|
|
8
|
-
metadata.constants.push(
|
|
9
|
-
MetadataConstant.create({
|
|
10
|
-
type: "string",
|
|
11
|
-
values: [
|
|
12
|
-
MetadataConstantValue.create({
|
|
13
|
-
value: key,
|
|
14
|
-
tags: [],
|
|
15
|
-
}),
|
|
16
|
-
],
|
|
17
|
-
}),
|
|
18
|
-
);
|
|
19
|
-
return metadata;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
1
|
+
import { Metadata } from "../../../schemas/metadata/Metadata";
|
|
2
|
+
import { MetadataConstant } from "../../../schemas/metadata/MetadataConstant";
|
|
3
|
+
import { MetadataConstantValue } from "../../../schemas/metadata/MetadataConstantValue";
|
|
4
|
+
|
|
5
|
+
export namespace MetadataHelper {
|
|
6
|
+
export const literal_to_metadata = (key: string): Metadata => {
|
|
7
|
+
const metadata: Metadata = Metadata.initialize();
|
|
8
|
+
metadata.constants.push(
|
|
9
|
+
MetadataConstant.create({
|
|
10
|
+
type: "string",
|
|
11
|
+
values: [
|
|
12
|
+
MetadataConstantValue.create({
|
|
13
|
+
value: key,
|
|
14
|
+
tags: [],
|
|
15
|
+
}),
|
|
16
|
+
],
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
return metadata;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -4,6 +4,13 @@ import { MapUtil } from "../utils/MapUtil";
|
|
|
4
4
|
|
|
5
5
|
export class ImportProgrammer {
|
|
6
6
|
private readonly assets_: Map<string, IAsset> = new Map();
|
|
7
|
+
private readonly options_: Readonly<ImportProgrammer.IOptions>;
|
|
8
|
+
|
|
9
|
+
public constructor(options?: Partial<ImportProgrammer.IOptions>) {
|
|
10
|
+
this.options_ = {
|
|
11
|
+
internalPrefix: options?.internalPrefix ?? "",
|
|
12
|
+
};
|
|
13
|
+
}
|
|
7
14
|
|
|
8
15
|
/* -----------------------------------------------------------
|
|
9
16
|
ENROLLMENTS
|
|
@@ -56,15 +63,10 @@ export class ImportProgrammer {
|
|
|
56
63
|
*/
|
|
57
64
|
public internal(name: string): ts.PropertyAccessExpression {
|
|
58
65
|
if (name.startsWith("$") === false) name = `$${name}`;
|
|
59
|
-
this.namespace({
|
|
60
|
-
file: `typia/lib/internal/${name}.js`,
|
|
61
|
-
name: alias(name),
|
|
62
|
-
type: false,
|
|
63
|
-
});
|
|
64
66
|
return ts.factory.createPropertyAccessExpression(
|
|
65
67
|
this.namespace({
|
|
66
68
|
file: `typia/lib/internal/${name}.js`,
|
|
67
|
-
name: alias(name),
|
|
69
|
+
name: this.alias(name),
|
|
68
70
|
type: false,
|
|
69
71
|
}),
|
|
70
72
|
name,
|
|
@@ -95,6 +97,10 @@ export class ImportProgrammer {
|
|
|
95
97
|
}));
|
|
96
98
|
}
|
|
97
99
|
|
|
100
|
+
private alias(name: string): string {
|
|
101
|
+
return `__${this.options_.internalPrefix}${name}`;
|
|
102
|
+
}
|
|
103
|
+
|
|
98
104
|
/* -----------------------------------------------------------
|
|
99
105
|
PROGRAM STATEMENTS
|
|
100
106
|
----------------------------------------------------------- */
|
|
@@ -156,6 +162,10 @@ export class ImportProgrammer {
|
|
|
156
162
|
}
|
|
157
163
|
|
|
158
164
|
export namespace ImportProgrammer {
|
|
165
|
+
export interface IOptions {
|
|
166
|
+
internalPrefix: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
159
169
|
export interface IDefault {
|
|
160
170
|
file: string;
|
|
161
171
|
name: string;
|
|
@@ -180,5 +190,3 @@ interface IAsset {
|
|
|
180
190
|
namespace: ImportProgrammer.INamespace | null;
|
|
181
191
|
instances: Map<string, ImportProgrammer.IInstance>;
|
|
182
192
|
}
|
|
183
|
-
|
|
184
|
-
const alias = (str: string) => `__${str}`;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Atomic } from "../../typings/Atomic";
|
|
2
|
-
|
|
3
|
-
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
-
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
5
|
-
|
|
6
|
-
export interface IMetadataConstantValue<T extends Atomic.Type> {
|
|
7
|
-
value: T;
|
|
8
|
-
tags: IMetadataTypeTag[][];
|
|
9
|
-
description?: string | null;
|
|
10
|
-
jsDocTags?: IJsDocTagInfo[];
|
|
11
|
-
}
|
|
1
|
+
import { Atomic } from "../../typings/Atomic";
|
|
2
|
+
|
|
3
|
+
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
+
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
5
|
+
|
|
6
|
+
export interface IMetadataConstantValue<T extends Atomic.Type> {
|
|
7
|
+
value: T;
|
|
8
|
+
tags: IMetadataTypeTag[][];
|
|
9
|
+
description?: string | null;
|
|
10
|
+
jsDocTags?: IJsDocTagInfo[];
|
|
11
|
+
}
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
-
import { IMetadataConstantValue } from "./IMetadataConstantValue";
|
|
5
|
-
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
6
|
-
|
|
7
|
-
export class MetadataConstantValue {
|
|
8
|
-
public readonly value: boolean | bigint | number | string;
|
|
9
|
-
public tags: IMetadataTypeTag[][];
|
|
10
|
-
public readonly description?: string | null;
|
|
11
|
-
public readonly jsDocTags?: IJsDocTagInfo[];
|
|
12
|
-
private name_?: string;
|
|
13
|
-
|
|
14
|
-
private constructor(props: ClassProperties<MetadataConstantValue>) {
|
|
15
|
-
this.value = props.value;
|
|
16
|
-
this.tags = props.tags;
|
|
17
|
-
this.description = props.description;
|
|
18
|
-
this.jsDocTags = props.jsDocTags;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public static create(
|
|
22
|
-
props: ClassProperties<MetadataConstantValue>,
|
|
23
|
-
): MetadataConstantValue {
|
|
24
|
-
return new MetadataConstantValue(props);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public static from(json: IMetadataConstantValue<any>): MetadataConstantValue {
|
|
28
|
-
return MetadataConstantValue.create({
|
|
29
|
-
value: typeof json.value === "bigint" ? BigInt(json.value) : json.value,
|
|
30
|
-
tags: json.tags,
|
|
31
|
-
description: json.description,
|
|
32
|
-
jsDocTags: json.jsDocTags,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public getName(): string {
|
|
37
|
-
return (this.name_ ??= getName(this));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public toJSON(): IMetadataConstantValue<any> {
|
|
41
|
-
return {
|
|
42
|
-
value:
|
|
43
|
-
typeof this.value === "bigint" ? this.value.toString() : this.value,
|
|
44
|
-
tags: this.tags,
|
|
45
|
-
description: this.description,
|
|
46
|
-
jsDocTags: this.jsDocTags,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const getName = (obj: MetadataConstantValue): string => {
|
|
52
|
-
const base: string =
|
|
53
|
-
typeof obj.value === "string"
|
|
54
|
-
? JSON.stringify(obj.value)
|
|
55
|
-
: obj.value.toString();
|
|
56
|
-
if (!obj.tags?.length) return base;
|
|
57
|
-
const rows: string[] = obj.tags.map((row) => {
|
|
58
|
-
const str: string = row.map((t) => t.name).join(" & ");
|
|
59
|
-
return row.length === 1 ? str : `(${str})`;
|
|
60
|
-
});
|
|
61
|
-
return `(${base} & (${rows.join(" | ")}))`;
|
|
62
|
-
};
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
+
import { IMetadataConstantValue } from "./IMetadataConstantValue";
|
|
5
|
+
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
6
|
+
|
|
7
|
+
export class MetadataConstantValue {
|
|
8
|
+
public readonly value: boolean | bigint | number | string;
|
|
9
|
+
public tags: IMetadataTypeTag[][];
|
|
10
|
+
public readonly description?: string | null;
|
|
11
|
+
public readonly jsDocTags?: IJsDocTagInfo[];
|
|
12
|
+
private name_?: string;
|
|
13
|
+
|
|
14
|
+
private constructor(props: ClassProperties<MetadataConstantValue>) {
|
|
15
|
+
this.value = props.value;
|
|
16
|
+
this.tags = props.tags;
|
|
17
|
+
this.description = props.description;
|
|
18
|
+
this.jsDocTags = props.jsDocTags;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public static create(
|
|
22
|
+
props: ClassProperties<MetadataConstantValue>,
|
|
23
|
+
): MetadataConstantValue {
|
|
24
|
+
return new MetadataConstantValue(props);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public static from(json: IMetadataConstantValue<any>): MetadataConstantValue {
|
|
28
|
+
return MetadataConstantValue.create({
|
|
29
|
+
value: typeof json.value === "bigint" ? BigInt(json.value) : json.value,
|
|
30
|
+
tags: json.tags,
|
|
31
|
+
description: json.description,
|
|
32
|
+
jsDocTags: json.jsDocTags,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public getName(): string {
|
|
37
|
+
return (this.name_ ??= getName(this));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public toJSON(): IMetadataConstantValue<any> {
|
|
41
|
+
return {
|
|
42
|
+
value:
|
|
43
|
+
typeof this.value === "bigint" ? this.value.toString() : this.value,
|
|
44
|
+
tags: this.tags,
|
|
45
|
+
description: this.description,
|
|
46
|
+
jsDocTags: this.jsDocTags,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const getName = (obj: MetadataConstantValue): string => {
|
|
52
|
+
const base: string =
|
|
53
|
+
typeof obj.value === "string"
|
|
54
|
+
? JSON.stringify(obj.value)
|
|
55
|
+
: obj.value.toString();
|
|
56
|
+
if (!obj.tags?.length) return base;
|
|
57
|
+
const rows: string[] = obj.tags.map((row) => {
|
|
58
|
+
const str: string = row.map((t) => t.name).join(" & ");
|
|
59
|
+
return row.length === 1 ? str : `(${str})`;
|
|
60
|
+
});
|
|
61
|
+
return `(${base} & (${rows.join(" | ")}))`;
|
|
62
|
+
};
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IProtobufProperty } from "../protobuf/IProtobufProperty";
|
|
4
|
-
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
5
|
-
import { IMetadataDictionary } from "./IMetadataDictionary";
|
|
6
|
-
import { IMetadataProperty } from "./IMetadataProperty";
|
|
7
|
-
import { Metadata } from "./Metadata";
|
|
8
|
-
|
|
9
|
-
export class MetadataProperty {
|
|
10
|
-
public readonly key: Metadata;
|
|
11
|
-
public readonly value: Metadata;
|
|
12
|
-
public readonly description: string | null;
|
|
13
|
-
public readonly jsDocTags: IJsDocTagInfo[];
|
|
14
|
-
|
|
15
|
-
public of_protobuf_?: IProtobufProperty;
|
|
16
|
-
|
|
17
|
-
/* -----------------------------------------------------------
|
|
18
|
-
CONSTRUCTORS
|
|
19
|
-
----------------------------------------------------------- */
|
|
20
|
-
/**
|
|
21
|
-
* @hidden
|
|
22
|
-
*/
|
|
23
|
-
private constructor(props: ClassProperties<MetadataProperty>) {
|
|
24
|
-
this.key = props.key;
|
|
25
|
-
this.value = props.value;
|
|
26
|
-
this.description = props.description;
|
|
27
|
-
this.jsDocTags = props.jsDocTags;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
public static create(
|
|
34
|
-
props: ClassProperties<MetadataProperty>,
|
|
35
|
-
): MetadataProperty {
|
|
36
|
-
return new MetadataProperty(props);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
public static from(property: IMetadataProperty, dict: IMetadataDictionary) {
|
|
43
|
-
return MetadataProperty.create({
|
|
44
|
-
key: Metadata.from(property.key, dict),
|
|
45
|
-
value: Metadata.from(property.value, dict),
|
|
46
|
-
description: property.description,
|
|
47
|
-
jsDocTags: property.jsDocTags.slice(),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public toJSON(): IMetadataProperty {
|
|
52
|
-
return {
|
|
53
|
-
key: this.key.toJSON(),
|
|
54
|
-
value: this.value.toJSON(),
|
|
55
|
-
description: this.description,
|
|
56
|
-
jsDocTags: this.jsDocTags,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IProtobufProperty } from "../protobuf/IProtobufProperty";
|
|
4
|
+
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
5
|
+
import { IMetadataDictionary } from "./IMetadataDictionary";
|
|
6
|
+
import { IMetadataProperty } from "./IMetadataProperty";
|
|
7
|
+
import { Metadata } from "./Metadata";
|
|
8
|
+
|
|
9
|
+
export class MetadataProperty {
|
|
10
|
+
public readonly key: Metadata;
|
|
11
|
+
public readonly value: Metadata;
|
|
12
|
+
public readonly description: string | null;
|
|
13
|
+
public readonly jsDocTags: IJsDocTagInfo[];
|
|
14
|
+
|
|
15
|
+
public of_protobuf_?: IProtobufProperty;
|
|
16
|
+
|
|
17
|
+
/* -----------------------------------------------------------
|
|
18
|
+
CONSTRUCTORS
|
|
19
|
+
----------------------------------------------------------- */
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
private constructor(props: ClassProperties<MetadataProperty>) {
|
|
24
|
+
this.key = props.key;
|
|
25
|
+
this.value = props.value;
|
|
26
|
+
this.description = props.description;
|
|
27
|
+
this.jsDocTags = props.jsDocTags;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
public static create(
|
|
34
|
+
props: ClassProperties<MetadataProperty>,
|
|
35
|
+
): MetadataProperty {
|
|
36
|
+
return new MetadataProperty(props);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
public static from(property: IMetadataProperty, dict: IMetadataDictionary) {
|
|
43
|
+
return MetadataProperty.create({
|
|
44
|
+
key: Metadata.from(property.key, dict),
|
|
45
|
+
value: Metadata.from(property.value, dict),
|
|
46
|
+
description: property.description,
|
|
47
|
+
jsDocTags: property.jsDocTags.slice(),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public toJSON(): IMetadataProperty {
|
|
52
|
+
return {
|
|
53
|
+
key: this.key.toJSON(),
|
|
54
|
+
value: this.value.toJSON(),
|
|
55
|
+
description: this.description,
|
|
56
|
+
jsDocTags: this.jsDocTags,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/tags/index.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export * from "./Constant";
|
|
2
|
-
export * from "./ContentMediaType";
|
|
3
|
-
export * from "./Default";
|
|
4
|
-
export * from "./Example";
|
|
5
|
-
export * from "./Examples";
|
|
6
|
-
export * from "./ExclusiveMaximum";
|
|
7
|
-
export * from "./ExclusiveMinimum";
|
|
8
|
-
export * from "./Format";
|
|
9
|
-
export * from "./JsonSchemaPlugin";
|
|
10
|
-
export * from "./Maximum";
|
|
11
|
-
export * from "./MaxItems";
|
|
12
|
-
export * from "./MaxLength";
|
|
13
|
-
export * from "./Minimum";
|
|
14
|
-
export * from "./MinItems";
|
|
15
|
-
export * from "./MinLength";
|
|
16
|
-
export * from "./MultipleOf";
|
|
17
|
-
export * from "./Pattern";
|
|
18
|
-
export * from "./Sequence";
|
|
19
|
-
export * from "./TagBase";
|
|
20
|
-
export * from "./Type";
|
|
21
|
-
export * from "./UniqueItems";
|
|
1
|
+
export * from "./Constant";
|
|
2
|
+
export * from "./ContentMediaType";
|
|
3
|
+
export * from "./Default";
|
|
4
|
+
export * from "./Example";
|
|
5
|
+
export * from "./Examples";
|
|
6
|
+
export * from "./ExclusiveMaximum";
|
|
7
|
+
export * from "./ExclusiveMinimum";
|
|
8
|
+
export * from "./Format";
|
|
9
|
+
export * from "./JsonSchemaPlugin";
|
|
10
|
+
export * from "./Maximum";
|
|
11
|
+
export * from "./MaxItems";
|
|
12
|
+
export * from "./MaxLength";
|
|
13
|
+
export * from "./Minimum";
|
|
14
|
+
export * from "./MinItems";
|
|
15
|
+
export * from "./MinLength";
|
|
16
|
+
export * from "./MultipleOf";
|
|
17
|
+
export * from "./Pattern";
|
|
18
|
+
export * from "./Sequence";
|
|
19
|
+
export * from "./TagBase";
|
|
20
|
+
export * from "./Type";
|
|
21
|
+
export * from "./UniqueItems";
|
|
@@ -15,7 +15,9 @@ export namespace FileTransformer {
|
|
|
15
15
|
(file: ts.SourceFile): ts.SourceFile => {
|
|
16
16
|
if (file.isDeclarationFile) return file;
|
|
17
17
|
|
|
18
|
-
const importer: ImportProgrammer = new ImportProgrammer(
|
|
18
|
+
const importer: ImportProgrammer = new ImportProgrammer({
|
|
19
|
+
internalPrefix: "typia_transform_",
|
|
20
|
+
});
|
|
19
21
|
const context: ITypiaContext = {
|
|
20
22
|
...environments,
|
|
21
23
|
transformer,
|