ts-runtime-validation 1.6.16 → 1.8.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.
- package/CONTRIBUTING.md +430 -0
- package/README.md +505 -62
- package/dist/ICommandOptions.js +3 -0
- package/dist/ICommandOptions.js.map +1 -0
- package/dist/SchemaGenerator.deterministic-extended.test.js +420 -0
- package/dist/SchemaGenerator.deterministic-extended.test.js.map +1 -0
- package/dist/SchemaGenerator.deterministic.test.js +251 -0
- package/dist/SchemaGenerator.deterministic.test.js.map +1 -0
- package/dist/SchemaGenerator.integration.test.js +323 -0
- package/dist/SchemaGenerator.integration.test.js.map +1 -0
- package/dist/SchemaGenerator.js +120 -0
- package/dist/SchemaGenerator.js.map +1 -0
- package/dist/SchemaGenerator.test.js +226 -0
- package/dist/SchemaGenerator.test.js.map +1 -0
- package/dist/cli.test.js +155 -0
- package/dist/cli.test.js.map +1 -0
- package/dist/errors/index.js +95 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/index.test.js +232 -0
- package/dist/errors/index.test.js.map +1 -0
- package/dist/getPosixPath.js +13 -0
- package/dist/getPosixPath.js.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/lib.js.map +1 -0
- package/dist/services/CodeGenerator.js +321 -0
- package/dist/services/CodeGenerator.js.map +1 -0
- package/dist/services/FileDiscovery.js +123 -0
- package/dist/services/FileDiscovery.js.map +1 -0
- package/dist/services/FileDiscovery.test.js +184 -0
- package/dist/services/FileDiscovery.test.js.map +1 -0
- package/dist/services/SchemaProcessor.js +198 -0
- package/dist/services/SchemaProcessor.js.map +1 -0
- package/dist/services/SchemaProcessor.test.js +455 -0
- package/dist/services/SchemaProcessor.test.js.map +1 -0
- package/dist/services/SchemaWriter.js +76 -0
- package/dist/services/SchemaWriter.js.map +1 -0
- package/dist/services/SchemaWriter.test.js +255 -0
- package/dist/services/SchemaWriter.test.js.map +1 -0
- package/dist/test/basic-scenario/types.jsonschema.js +3 -0
- package/dist/test/basic-scenario/types.jsonschema.js.map +1 -0
- package/dist/test/duplicate-symbols-different-implementation/IBaseType.js +3 -0
- package/dist/test/duplicate-symbols-different-implementation/IBaseType.js.map +1 -0
- package/dist/test/duplicate-symbols-different-implementation/IBaseTypeDefinitionReplicated.js +3 -0
- package/dist/test/duplicate-symbols-different-implementation/IBaseTypeDefinitionReplicated.js.map +1 -0
- package/dist/test/duplicate-symbols-different-implementation/IBasicTypesA.jsonschema.js +3 -0
- package/dist/test/duplicate-symbols-different-implementation/IBasicTypesA.jsonschema.js.map +1 -0
- package/dist/test/duplicate-symbols-different-implementation/IBasicTypesB.jsonschema.js +3 -0
- package/dist/test/duplicate-symbols-different-implementation/IBasicTypesB.jsonschema.js.map +1 -0
- package/dist/test/duplicate-symbols-identitcal-implementation/IBaseType.js +3 -0
- package/dist/test/duplicate-symbols-identitcal-implementation/IBaseType.js.map +1 -0
- package/dist/test/duplicate-symbols-identitcal-implementation/IBaseTypeDefinitionReplicated.js +3 -0
- package/dist/test/duplicate-symbols-identitcal-implementation/IBaseTypeDefinitionReplicated.js.map +1 -0
- package/dist/test/duplicate-symbols-identitcal-implementation/IBasicTypesA.jsonschema.js +3 -0
- package/dist/test/duplicate-symbols-identitcal-implementation/IBasicTypesA.jsonschema.js.map +1 -0
- package/dist/test/duplicate-symbols-identitcal-implementation/IBasicTypesB.jsonschema.js +3 -0
- package/dist/test/duplicate-symbols-identitcal-implementation/IBasicTypesB.jsonschema.js.map +1 -0
- package/dist/utils/ProgressReporter.js +67 -0
- package/dist/utils/ProgressReporter.js.map +1 -0
- package/dist/utils/ProgressReporter.test.js +267 -0
- package/dist/utils/ProgressReporter.test.js.map +1 -0
- package/dist/writeLine.js +12 -0
- package/dist/writeLine.js.map +1 -0
- package/package.json +2 -2
- package/src/ICommandOptions.ts +7 -0
- package/src/SchemaGenerator.deterministic-extended.test.ts +429 -0
- package/src/SchemaGenerator.deterministic.test.ts +276 -0
- package/src/SchemaGenerator.integration.test.ts +411 -0
- package/src/SchemaGenerator.test.ts +118 -0
- package/src/SchemaGenerator.ts +112 -298
- package/src/cli.test.ts +130 -0
- package/src/errors/index.test.ts +319 -0
- package/src/errors/index.ts +92 -0
- package/src/index.ts +8 -1
- package/src/services/CodeGenerator.ts +370 -0
- package/src/services/FileDiscovery.test.ts +216 -0
- package/src/services/FileDiscovery.ts +140 -0
- package/src/services/SchemaProcessor.test.ts +536 -0
- package/src/services/SchemaProcessor.ts +194 -0
- package/src/services/SchemaWriter.test.ts +304 -0
- package/src/services/SchemaWriter.ts +75 -0
- package/src/utils/ProgressReporter.test.ts +357 -0
- package/src/utils/ProgressReporter.ts +76 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("./index");
|
|
4
|
+
describe("Error Classes", () => {
|
|
5
|
+
describe("BaseError", () => {
|
|
6
|
+
it("should create error with message and code", () => {
|
|
7
|
+
const error = new index_1.BaseError("Test message", "TEST_CODE");
|
|
8
|
+
expect(error.message).toBe("Test message");
|
|
9
|
+
expect(error.code).toBe("TEST_CODE");
|
|
10
|
+
expect(error.name).toBe("BaseError");
|
|
11
|
+
expect(error instanceof Error).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
it("should capture stack trace", () => {
|
|
14
|
+
const error = new index_1.BaseError("Test", "CODE");
|
|
15
|
+
expect(error.stack).toBeDefined();
|
|
16
|
+
expect(error.stack).toContain("BaseError");
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
describe("FileDiscoveryError", () => {
|
|
20
|
+
it("should create error with path information", () => {
|
|
21
|
+
const error = new index_1.FileDiscoveryError("File not found", "/path/to/file");
|
|
22
|
+
expect(error.message).toBe("File not found");
|
|
23
|
+
expect(error.code).toBe("FILE_DISCOVERY_ERROR");
|
|
24
|
+
expect(error.path).toBe("/path/to/file");
|
|
25
|
+
expect(error.name).toBe("FileDiscoveryError");
|
|
26
|
+
});
|
|
27
|
+
it("should work without path", () => {
|
|
28
|
+
const error = new index_1.FileDiscoveryError("General error");
|
|
29
|
+
expect(error.message).toBe("General error");
|
|
30
|
+
expect(error.path).toBeUndefined();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe("SchemaGenerationError", () => {
|
|
34
|
+
it("should create error with file information", () => {
|
|
35
|
+
const error = new index_1.SchemaGenerationError("Schema generation failed", "user.ts");
|
|
36
|
+
expect(error.message).toBe("Schema generation failed");
|
|
37
|
+
expect(error.code).toBe("SCHEMA_GENERATION_ERROR");
|
|
38
|
+
expect(error.file).toBe("user.ts");
|
|
39
|
+
});
|
|
40
|
+
it("should work without file", () => {
|
|
41
|
+
const error = new index_1.SchemaGenerationError("General schema error");
|
|
42
|
+
expect(error.message).toBe("General schema error");
|
|
43
|
+
expect(error.file).toBeUndefined();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe("DuplicateSymbolError", () => {
|
|
47
|
+
it("should create error with symbol details", () => {
|
|
48
|
+
const existingDef = { type: "object", properties: { id: { type: "string" } } };
|
|
49
|
+
const newDef = { type: "object", properties: { id: { type: "number" } } };
|
|
50
|
+
const error = new index_1.DuplicateSymbolError("Duplicate symbol found", "IUser", "user2.ts", existingDef, newDef);
|
|
51
|
+
expect(error.message).toBe("Duplicate symbol found");
|
|
52
|
+
expect(error.code).toBe("DUPLICATE_SYMBOL_ERROR");
|
|
53
|
+
expect(error.symbol).toBe("IUser");
|
|
54
|
+
expect(error.file).toBe("user2.ts");
|
|
55
|
+
expect(error.existingDefinition).toBe(existingDef);
|
|
56
|
+
expect(error.newDefinition).toBe(newDef);
|
|
57
|
+
});
|
|
58
|
+
it("should provide detailed message", () => {
|
|
59
|
+
const existingDef = { type: "string" };
|
|
60
|
+
const newDef = { type: "number" };
|
|
61
|
+
const error = new index_1.DuplicateSymbolError("Conflict", "TestType", "test.ts", existingDef, newDef);
|
|
62
|
+
const detailed = error.getDetailedMessage();
|
|
63
|
+
expect(detailed).toContain("Conflict");
|
|
64
|
+
expect(detailed).toContain("Symbol: TestType");
|
|
65
|
+
expect(detailed).toContain("File: test.ts");
|
|
66
|
+
expect(detailed).toContain("Existing Definition:");
|
|
67
|
+
expect(detailed).toContain("New Definition:");
|
|
68
|
+
expect(detailed).toContain(JSON.stringify(existingDef, null, 2));
|
|
69
|
+
expect(detailed).toContain(JSON.stringify(newDef, null, 2));
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
describe("CodeGenerationError", () => {
|
|
73
|
+
it("should create error with output file information", () => {
|
|
74
|
+
const error = new index_1.CodeGenerationError("Generation failed", "output.ts");
|
|
75
|
+
expect(error.message).toBe("Generation failed");
|
|
76
|
+
expect(error.code).toBe("CODE_GENERATION_ERROR");
|
|
77
|
+
expect(error.outputFile).toBe("output.ts");
|
|
78
|
+
});
|
|
79
|
+
it("should work without output file", () => {
|
|
80
|
+
const error = new index_1.CodeGenerationError("General generation error");
|
|
81
|
+
expect(error.message).toBe("General generation error");
|
|
82
|
+
expect(error.outputFile).toBeUndefined();
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
describe("ValidationError", () => {
|
|
86
|
+
it("should create error with validation errors", () => {
|
|
87
|
+
const validationErrors = [
|
|
88
|
+
{ path: "user.name", message: "Required field missing" },
|
|
89
|
+
{ path: "user.age", message: "Must be a number" }
|
|
90
|
+
];
|
|
91
|
+
const error = new index_1.ValidationError("Validation failed", validationErrors);
|
|
92
|
+
expect(error.message).toBe("Validation failed");
|
|
93
|
+
expect(error.code).toBe("VALIDATION_ERROR");
|
|
94
|
+
expect(error.errors).toBe(validationErrors);
|
|
95
|
+
});
|
|
96
|
+
it("should provide detailed message", () => {
|
|
97
|
+
const validationErrors = [
|
|
98
|
+
{ path: "user.name", message: "Required" },
|
|
99
|
+
{ path: "user.email", message: "Invalid format" }
|
|
100
|
+
];
|
|
101
|
+
const error = new index_1.ValidationError("Failed", validationErrors);
|
|
102
|
+
const detailed = error.getDetailedMessage();
|
|
103
|
+
expect(detailed).toContain("Failed");
|
|
104
|
+
expect(detailed).toContain("user.name: Required");
|
|
105
|
+
expect(detailed).toContain("user.email: Invalid format");
|
|
106
|
+
});
|
|
107
|
+
it("should handle empty errors array", () => {
|
|
108
|
+
const error = new index_1.ValidationError("No specific errors", []);
|
|
109
|
+
const detailed = error.getDetailedMessage();
|
|
110
|
+
expect(detailed).toBe("No specific errors\n");
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
describe("ConfigurationError", () => {
|
|
114
|
+
it("should create error with field information", () => {
|
|
115
|
+
const error = new index_1.ConfigurationError("Invalid configuration", "rootPath");
|
|
116
|
+
expect(error.message).toBe("Invalid configuration");
|
|
117
|
+
expect(error.code).toBe("CONFIGURATION_ERROR");
|
|
118
|
+
expect(error.field).toBe("rootPath");
|
|
119
|
+
});
|
|
120
|
+
it("should work without field", () => {
|
|
121
|
+
const error = new index_1.ConfigurationError("General config error");
|
|
122
|
+
expect(error.message).toBe("General config error");
|
|
123
|
+
expect(error.field).toBeUndefined();
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe("CacheError", () => {
|
|
127
|
+
it("should create error with operation information", () => {
|
|
128
|
+
const error = new index_1.CacheError("Cache operation failed", "read");
|
|
129
|
+
expect(error.message).toBe("Cache operation failed");
|
|
130
|
+
expect(error.code).toBe("CACHE_ERROR");
|
|
131
|
+
expect(error.operation).toBe("read");
|
|
132
|
+
});
|
|
133
|
+
it("should work without operation", () => {
|
|
134
|
+
const error = new index_1.CacheError("General cache error");
|
|
135
|
+
expect(error.message).toBe("General cache error");
|
|
136
|
+
expect(error.operation).toBeUndefined();
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
describe("Error Utilities", () => {
|
|
141
|
+
describe("isKnownError", () => {
|
|
142
|
+
it("should return true for known errors", () => {
|
|
143
|
+
expect((0, index_1.isKnownError)(new index_1.FileDiscoveryError("test"))).toBe(true);
|
|
144
|
+
expect((0, index_1.isKnownError)(new index_1.SchemaGenerationError("test"))).toBe(true);
|
|
145
|
+
expect((0, index_1.isKnownError)(new index_1.DuplicateSymbolError("test", "sym", "file", {}, {}))).toBe(true);
|
|
146
|
+
expect((0, index_1.isKnownError)(new index_1.CodeGenerationError("test"))).toBe(true);
|
|
147
|
+
expect((0, index_1.isKnownError)(new index_1.ValidationError("test", []))).toBe(true);
|
|
148
|
+
expect((0, index_1.isKnownError)(new index_1.ConfigurationError("test"))).toBe(true);
|
|
149
|
+
expect((0, index_1.isKnownError)(new index_1.CacheError("test"))).toBe(true);
|
|
150
|
+
});
|
|
151
|
+
it("should return false for unknown errors", () => {
|
|
152
|
+
expect((0, index_1.isKnownError)(new Error("regular error"))).toBe(false);
|
|
153
|
+
expect((0, index_1.isKnownError)(new TypeError("type error"))).toBe(false);
|
|
154
|
+
expect((0, index_1.isKnownError)("string error")).toBe(false);
|
|
155
|
+
expect((0, index_1.isKnownError)(null)).toBe(false);
|
|
156
|
+
expect((0, index_1.isKnownError)(undefined)).toBe(false);
|
|
157
|
+
expect((0, index_1.isKnownError)({ message: "object error" })).toBe(false);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
describe("formatError", () => {
|
|
161
|
+
it("should format known errors with code", () => {
|
|
162
|
+
const error = new index_1.FileDiscoveryError("File not found");
|
|
163
|
+
const formatted = (0, index_1.formatError)(error);
|
|
164
|
+
expect(formatted).toBe("[FILE_DISCOVERY_ERROR] File not found");
|
|
165
|
+
});
|
|
166
|
+
it("should use detailed message in verbose mode", () => {
|
|
167
|
+
const validationErrors = [
|
|
168
|
+
{ path: "user.name", message: "Required" }
|
|
169
|
+
];
|
|
170
|
+
const error = new index_1.ValidationError("Validation failed", validationErrors);
|
|
171
|
+
const formatted = (0, index_1.formatError)(error, true);
|
|
172
|
+
expect(formatted).toContain("Validation failed");
|
|
173
|
+
expect(formatted).toContain("user.name: Required");
|
|
174
|
+
});
|
|
175
|
+
it("should format regular errors", () => {
|
|
176
|
+
const error = new Error("Regular error");
|
|
177
|
+
expect((0, index_1.formatError)(error, false)).toBe("Regular error");
|
|
178
|
+
expect((0, index_1.formatError)(error, true)).toContain("Regular error");
|
|
179
|
+
});
|
|
180
|
+
it("should include stack trace in verbose mode for regular errors", () => {
|
|
181
|
+
const error = new Error("Test error");
|
|
182
|
+
const formatted = (0, index_1.formatError)(error, true);
|
|
183
|
+
expect(formatted).toContain("Error: Test error");
|
|
184
|
+
});
|
|
185
|
+
it("should handle errors without stack", () => {
|
|
186
|
+
const error = new Error("No stack");
|
|
187
|
+
error.stack = undefined;
|
|
188
|
+
const formatted = (0, index_1.formatError)(error, true);
|
|
189
|
+
expect(formatted).toBe("No stack");
|
|
190
|
+
});
|
|
191
|
+
it("should handle non-error objects", () => {
|
|
192
|
+
expect((0, index_1.formatError)("string error")).toBe("string error");
|
|
193
|
+
expect((0, index_1.formatError)(123)).toBe("123");
|
|
194
|
+
expect((0, index_1.formatError)(null)).toBe("null");
|
|
195
|
+
expect((0, index_1.formatError)(undefined)).toBe("undefined");
|
|
196
|
+
expect((0, index_1.formatError)({ message: "object" })).toBe("[object Object]");
|
|
197
|
+
});
|
|
198
|
+
it("should handle DuplicateSymbolError detailed message", () => {
|
|
199
|
+
const error = new index_1.DuplicateSymbolError("Duplicate found", "ITest", "test.ts", { type: "string" }, { type: "number" });
|
|
200
|
+
const formatted = (0, index_1.formatError)(error, true);
|
|
201
|
+
expect(formatted).toContain("Symbol: ITest");
|
|
202
|
+
expect(formatted).toContain("File: test.ts");
|
|
203
|
+
});
|
|
204
|
+
it("should not use detailed message for errors without it", () => {
|
|
205
|
+
const error = new index_1.FileDiscoveryError("Test error");
|
|
206
|
+
const formatted = (0, index_1.formatError)(error, true);
|
|
207
|
+
expect(formatted).toBe("[FILE_DISCOVERY_ERROR] Test error");
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
describe("error inheritance", () => {
|
|
211
|
+
it("should maintain proper instanceof relationships", () => {
|
|
212
|
+
const fileError = new index_1.FileDiscoveryError("test");
|
|
213
|
+
expect(fileError instanceof index_1.FileDiscoveryError).toBe(true);
|
|
214
|
+
expect(fileError instanceof index_1.BaseError).toBe(true);
|
|
215
|
+
expect(fileError instanceof Error).toBe(true);
|
|
216
|
+
});
|
|
217
|
+
it("should have correct constructor names", () => {
|
|
218
|
+
const errors = [
|
|
219
|
+
new index_1.FileDiscoveryError("test"),
|
|
220
|
+
new index_1.SchemaGenerationError("test"),
|
|
221
|
+
new index_1.CodeGenerationError("test"),
|
|
222
|
+
new index_1.ValidationError("test", []),
|
|
223
|
+
new index_1.ConfigurationError("test"),
|
|
224
|
+
new index_1.CacheError("test")
|
|
225
|
+
];
|
|
226
|
+
errors.forEach(error => {
|
|
227
|
+
expect(error.constructor.name).toBe(error.name);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/errors/index.test.ts"],"names":[],"mappings":";;AAAA,mCAWiB;AAEjB,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC3B,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACvB,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACjD,MAAM,KAAK,GAAG,IAAI,iBAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;YAEzD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACrC,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC,CA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E,CAAC,iDAAiD,EAAE,GAAG,EAAE;YACvD,MAAM,SAAS,GAAG,IAAI,0BAAkB,CAAC,MAAM,CAAC,CAAC;YAEjD,MAAM,CAAC,SAAS,YAAY,0BAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3D,MAAM,CAAC,SAAS,YAAY,iBAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClD,MAAM,CAAC,SAAS,YAAY,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC7C,MAAM,MAAM,GAAG;gBACX,IAAI,0BAAkB,CAAC,MAAM,CAAC;gBAC9B,IAAI,6BAAqB,CAAC,MAAM,CAAC;gBACjC,IAAI,2BAAmB,CAAC,MAAM,CAAC;gBAC/B,IAAI,uBAAe,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC/B,IAAI,0BAAkB,CAAC,MAAM,CAAC;gBAC9B,IAAI,kBAAU,CAAC,MAAM,CAAC;aACzB,CAAC;YAEF,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACnB,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPosixPath = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const getPosixPath = (rawPath) => {
|
|
9
|
+
const definitelyPosix = rawPath.split(path_1.default.sep).join(path_1.default.posix.sep);
|
|
10
|
+
return definitelyPosix;
|
|
11
|
+
};
|
|
12
|
+
exports.getPosixPath = getPosixPath;
|
|
13
|
+
//# sourceMappingURL=getPosixPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPosixPath.js","sourceRoot":"","sources":["../src/getPosixPath.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAEjB,MAAM,YAAY,GAAG,CAAC,OAAe,EAAE,EAAE;IAC5C,MAAM,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,cAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,cAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrE,OAAO,eAAe,CAAC;AAC3B,CAAC,CAAC;AAHW,QAAA,YAAY,gBAGvB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const SchemaGenerator_1 = require("./SchemaGenerator");
|
|
5
|
+
const commander_1 = require("commander");
|
|
6
|
+
const defaultGlobPattern = "*.jsonschema.{ts,tsx}";
|
|
7
|
+
const defaultRootPath = "./src";
|
|
8
|
+
const defaultOutputFolder = "./.ts-runtime-validation";
|
|
9
|
+
const defaultTsconfig = "";
|
|
10
|
+
commander_1.program.option("--glob <glob>", `Glob file path of typescript files to generate ts-interface -> json-schema validations - default: ${defaultGlobPattern}`, defaultGlobPattern);
|
|
11
|
+
commander_1.program.option("--rootPath <rootFolder>", `RootPath of source`, defaultRootPath);
|
|
12
|
+
commander_1.program.option("--output <outputFolder>", `Code generation output directory (relative to root path)`, defaultOutputFolder);
|
|
13
|
+
commander_1.program.option("--tsconfigPath <tsconfigPath>", `Path to customt tsconfig (relative to root path)`, defaultTsconfig);
|
|
14
|
+
commander_1.program.option("--generate-helpers", "Only generate JSON schema without typescript helper files", true);
|
|
15
|
+
commander_1.program.option("--additionalProperties", "Allow additional properties to pass validation", false);
|
|
16
|
+
commander_1.program.option("--verbose", "Enable verbose logging", false);
|
|
17
|
+
commander_1.program.option("--progress", "Show progress information", false);
|
|
18
|
+
commander_1.program.option("--minify", "Minify generated output", false);
|
|
19
|
+
commander_1.program.option("--cache", "Enable file caching for incremental builds", false);
|
|
20
|
+
commander_1.program.option("--no-parallel", "Disable parallel processing", false);
|
|
21
|
+
commander_1.program.option("--tree-shaking", "Generate tree-shaking friendly exports", false);
|
|
22
|
+
commander_1.program.option("--lazy-load", "Generate lazy-loaded validators", false);
|
|
23
|
+
commander_1.program.parse();
|
|
24
|
+
const options = commander_1.program.opts();
|
|
25
|
+
const generator = new SchemaGenerator_1.SchemaGenerator(options);
|
|
26
|
+
generator.Generate();
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAGA,uDAAoD;AACpD,yCAAoC;AAEpC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAEnD,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AACvD,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,mBAAO,CAAC,MAAM,CACV,eAAe,EACf,qGAAqG,kBAAkB,EAAE,EACzH,kBAAkB,CACrB,CAAC;AACF,mBAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAC;AACjF,mBAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,0DAA0D,EAAE,mBAAmB,CAAC,CAAC;AAC3H,mBAAO,CAAC,MAAM,CAAC,+BAA+B,EAAE,kDAAkD,EAAE,eAAe,CAAC,CAAC;AACrH,mBAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,2DAA2D,EAAE,IAAI,CAAC,CAAC;AACxG,mBAAO,CAAC,MAAM,CAAC,wBAAwB,EAAE,gDAAgD,EAAE,KAAK,CAAC,CAAC;AAClG,mBAAO,CAAC,MAAM,CAAC,WAAW,EAAE,wBAAwB,EAAE,KAAK,CAAC,CAAC;AAC7D,mBAAO,CAAC,MAAM,CAAC,YAAY,EAAE,2BAA2B,EAAE,KAAK,CAAC,CAAC;AACjE,mBAAO,CAAC,MAAM,CAAC,UAAU,EAAE,yBAAyB,EAAE,KAAK,CAAC,CAAC;AAC7D,mBAAO,CAAC,MAAM,CAAC,SAAS,EAAE,4CAA4C,EAAE,KAAK,CAAC,CAAC;AAC/E,mBAAO,CAAC,MAAM,CAAC,eAAe,EAAE,6BAA6B,EAAE,KAAK,CAAC,CAAC;AACtE,mBAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,wCAAwC,EAAE,KAAK,CAAC,CAAC;AAClF,mBAAO,CAAC,MAAM,CAAC,aAAa,EAAE,iCAAiC,EAAE,KAAK,CAAC,CAAC;AAExE,mBAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,MAAM,OAAO,GAAG,mBAAO,CAAC,IAAI,EAAmB,CAAC;AAEhD,MAAM,SAAS,GAAG,IAAI,iCAAe,CAAC,OAAO,CAAC,CAAC;AAC/C,SAAS,CAAC,QAAQ,EAAE,CAAC"}
|
package/dist/lib.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAA3C,kHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CodeGenerator = void 0;
|
|
16
|
+
const ts_morph_1 = require("ts-morph");
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const getPosixPath_1 = require("../getPosixPath");
|
|
19
|
+
const errors_1 = require("../errors");
|
|
20
|
+
const defaultTsMorphProjectSettings = {
|
|
21
|
+
manipulationSettings: {
|
|
22
|
+
indentationText: ts_morph_1.IndentationText.FourSpaces,
|
|
23
|
+
newLineKind: ts_morph_1.NewLineKind.LineFeed,
|
|
24
|
+
quoteKind: ts_morph_1.QuoteKind.Double,
|
|
25
|
+
usePrefixAndSuffixTextForRename: false,
|
|
26
|
+
useTrailingCommas: true,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const defaultCreateFileOptions = {
|
|
30
|
+
overwrite: true,
|
|
31
|
+
};
|
|
32
|
+
class CodeGenerator {
|
|
33
|
+
constructor(options) {
|
|
34
|
+
this.options = options;
|
|
35
|
+
this.project = new ts_morph_1.Project(defaultTsMorphProjectSettings);
|
|
36
|
+
}
|
|
37
|
+
generateSchemaDefinition(schemaMap, outputFile) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
try {
|
|
40
|
+
const typeInfos = this.extractTypeInfo(schemaMap);
|
|
41
|
+
yield this.writeSchemaDefinitionFile(typeInfos, outputFile);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
throw new errors_1.CodeGenerationError(`Failed to generate schema definition: ${error instanceof Error ? error.message : String(error)}`);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
generateValidatorFunction(outputFile) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
try {
|
|
51
|
+
const sourceFile = this.project.createSourceFile(outputFile, {}, defaultCreateFileOptions);
|
|
52
|
+
if (this.options.lazyLoad) {
|
|
53
|
+
this.generateLazyValidator(sourceFile);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.generateStandardValidator(sourceFile);
|
|
57
|
+
}
|
|
58
|
+
yield this.project.save();
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
throw new errors_1.CodeGenerationError(`Failed to generate validator function: ${error instanceof Error ? error.message : String(error)}`);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
generateValidationTypes(schemaMap, outputFile) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
try {
|
|
68
|
+
const typeInfos = this.extractTypeInfo(schemaMap);
|
|
69
|
+
yield this.writeValidationTypesFile(typeInfos, outputFile);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
throw new errors_1.CodeGenerationError(`Failed to generate validation types: ${error instanceof Error ? error.message : String(error)}`);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
extractTypeInfo(schemaMap) {
|
|
77
|
+
var _a;
|
|
78
|
+
const readerProject = new ts_morph_1.Project(defaultTsMorphProjectSettings);
|
|
79
|
+
const typeInfos = [];
|
|
80
|
+
// Sort schema map entries by file path for consistent processing order
|
|
81
|
+
const sortedEntries = [...schemaMap.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
82
|
+
for (const [filePath, schema] of sortedEntries) {
|
|
83
|
+
const dir = path_1.default.dirname(filePath);
|
|
84
|
+
const fileWithoutExtension = path_1.default.parse(filePath).name;
|
|
85
|
+
const relativeFilePath = path_1.default.relative(this.options.outputPath, dir);
|
|
86
|
+
const relativeImportPath = `${relativeFilePath}/${fileWithoutExtension}`;
|
|
87
|
+
const defs = (_a = schema.definitions) !== null && _a !== void 0 ? _a : {};
|
|
88
|
+
const readerSourceFile = readerProject.addSourceFileAtPath(filePath);
|
|
89
|
+
// Sort definition keys alphabetically
|
|
90
|
+
Object.keys(defs).sort().forEach((symbol) => {
|
|
91
|
+
const typeAlias = readerSourceFile.getTypeAlias(symbol);
|
|
92
|
+
const typeInterface = readerSourceFile.getInterface(symbol);
|
|
93
|
+
if (typeAlias || typeInterface) {
|
|
94
|
+
typeInfos.push({
|
|
95
|
+
symbol,
|
|
96
|
+
importPath: (0, getPosixPath_1.getPosixPath)(relativeImportPath),
|
|
97
|
+
isInterface: !!typeInterface
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// Sort typeInfos alphabetically by symbol
|
|
103
|
+
return typeInfos.sort((a, b) => a.symbol.localeCompare(b.symbol));
|
|
104
|
+
}
|
|
105
|
+
writeSchemaDefinitionFile(typeInfos, outputFile) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const sourceFile = this.project.createSourceFile(outputFile, {}, defaultCreateFileOptions);
|
|
108
|
+
if (this.options.treeShaking) {
|
|
109
|
+
this.generateTreeShakingImports(sourceFile, typeInfos);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
this.generateStandardImports(sourceFile, typeInfos);
|
|
113
|
+
}
|
|
114
|
+
sourceFile.addVariableStatement({
|
|
115
|
+
isExported: true,
|
|
116
|
+
declarationKind: ts_morph_1.VariableDeclarationKind.Const,
|
|
117
|
+
declarations: [
|
|
118
|
+
{
|
|
119
|
+
name: "schemas",
|
|
120
|
+
type: "Record<keyof ISchema, string>",
|
|
121
|
+
initializer: (writer) => {
|
|
122
|
+
writer.writeLine(`{`);
|
|
123
|
+
// Sort by symbol for consistent output
|
|
124
|
+
[...typeInfos].sort((a, b) => a.symbol.localeCompare(b.symbol)).forEach(({ symbol }) => {
|
|
125
|
+
writer.writeLine(`["#/definitions/${symbol}"] : "${symbol}",`);
|
|
126
|
+
});
|
|
127
|
+
writer.writeLine(`}`);
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
});
|
|
132
|
+
sourceFile.addInterface({
|
|
133
|
+
kind: ts_morph_1.StructureKind.Interface,
|
|
134
|
+
name: "ISchema",
|
|
135
|
+
isExported: true,
|
|
136
|
+
properties: [...typeInfos].sort((a, b) => a.symbol.localeCompare(b.symbol)).map(({ symbol }) => ({
|
|
137
|
+
name: `readonly ["#/definitions/${symbol}"]`,
|
|
138
|
+
type: symbol
|
|
139
|
+
})),
|
|
140
|
+
});
|
|
141
|
+
yield this.project.save();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
generateTreeShakingImports(sourceFile, typeInfos) {
|
|
145
|
+
const importMap = new Map();
|
|
146
|
+
typeInfos.forEach(({ symbol, importPath }) => {
|
|
147
|
+
const existing = importMap.get(importPath) || [];
|
|
148
|
+
existing.push(symbol);
|
|
149
|
+
importMap.set(importPath, existing);
|
|
150
|
+
});
|
|
151
|
+
// Sort import paths and symbols alphabetically
|
|
152
|
+
const sortedImportPaths = Array.from(importMap.keys()).sort();
|
|
153
|
+
sortedImportPaths.forEach((importPath) => {
|
|
154
|
+
const symbols = importMap.get(importPath).sort();
|
|
155
|
+
sourceFile.addImportDeclaration({
|
|
156
|
+
namedImports: symbols,
|
|
157
|
+
moduleSpecifier: importPath
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
generateStandardImports(sourceFile, typeInfos) {
|
|
162
|
+
const importMap = new Map();
|
|
163
|
+
typeInfos.forEach(({ symbol, importPath }) => {
|
|
164
|
+
const existing = importMap.get(importPath) || [];
|
|
165
|
+
existing.push(symbol);
|
|
166
|
+
importMap.set(importPath, existing);
|
|
167
|
+
});
|
|
168
|
+
// Sort import paths and symbols alphabetically
|
|
169
|
+
const sortedImportPaths = Array.from(importMap.keys()).sort();
|
|
170
|
+
sortedImportPaths.forEach((importPath) => {
|
|
171
|
+
const symbols = importMap.get(importPath).sort();
|
|
172
|
+
sourceFile.addImportDeclaration({
|
|
173
|
+
namedImports: symbols,
|
|
174
|
+
moduleSpecifier: importPath
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
generateLazyValidator(sourceFile) {
|
|
179
|
+
sourceFile.addImportDeclaration({
|
|
180
|
+
namespaceImport: "schema",
|
|
181
|
+
moduleSpecifier: "./validation.schema.json"
|
|
182
|
+
});
|
|
183
|
+
sourceFile.addImportDeclaration({
|
|
184
|
+
namedImports: ["ISchema", "schemas"],
|
|
185
|
+
moduleSpecifier: "./SchemaDefinition"
|
|
186
|
+
});
|
|
187
|
+
sourceFile.addVariableStatement({
|
|
188
|
+
isExported: true,
|
|
189
|
+
declarationKind: ts_morph_1.VariableDeclarationKind.Let,
|
|
190
|
+
declarations: [
|
|
191
|
+
{
|
|
192
|
+
name: "validator",
|
|
193
|
+
type: "any",
|
|
194
|
+
initializer: "null"
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
sourceFile.addFunction({
|
|
199
|
+
name: "getValidator",
|
|
200
|
+
isExported: false,
|
|
201
|
+
statements: (writer) => {
|
|
202
|
+
writer.writeLine(`if (!validator) {`);
|
|
203
|
+
writer.writeLine(` const Ajv = require("ajv");`);
|
|
204
|
+
writer.writeLine(` validator = new Ajv({ allErrors: true });`);
|
|
205
|
+
writer.writeLine(` validator.compile(schema);`);
|
|
206
|
+
writer.writeLine(`}`);
|
|
207
|
+
writer.writeLine(`return validator;`);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
sourceFile.addVariableStatement({
|
|
211
|
+
declarationKind: ts_morph_1.VariableDeclarationKind.Const,
|
|
212
|
+
isExported: true,
|
|
213
|
+
declarations: [
|
|
214
|
+
{
|
|
215
|
+
name: "isValidSchema",
|
|
216
|
+
initializer: (writer) => {
|
|
217
|
+
writer.writeLine(`<T extends keyof typeof schemas>(data: unknown, schemaKeyRef: T): data is ISchema[T] => {`);
|
|
218
|
+
writer.writeLine(`const v = getValidator();`);
|
|
219
|
+
writer.writeLine(`v.validate(schemaKeyRef as string, data);`);
|
|
220
|
+
writer.writeLine(`return Boolean(v.errors) === false;`);
|
|
221
|
+
writer.writeLine(`}`);
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
generateStandardValidator(sourceFile) {
|
|
228
|
+
sourceFile.addImportDeclaration({
|
|
229
|
+
namespaceImport: "schema",
|
|
230
|
+
moduleSpecifier: "./validation.schema.json"
|
|
231
|
+
});
|
|
232
|
+
sourceFile.addImportDeclaration({
|
|
233
|
+
defaultImport: "Ajv",
|
|
234
|
+
moduleSpecifier: "ajv"
|
|
235
|
+
});
|
|
236
|
+
sourceFile.addImportDeclaration({
|
|
237
|
+
namedImports: ["ISchema", "schemas"],
|
|
238
|
+
moduleSpecifier: "./SchemaDefinition"
|
|
239
|
+
});
|
|
240
|
+
sourceFile.addVariableStatement({
|
|
241
|
+
isExported: true,
|
|
242
|
+
declarationKind: ts_morph_1.VariableDeclarationKind.Const,
|
|
243
|
+
declarations: [
|
|
244
|
+
{
|
|
245
|
+
name: "validator",
|
|
246
|
+
initializer: (writer) => {
|
|
247
|
+
writer.writeLine(`new Ajv({ allErrors: true });`);
|
|
248
|
+
writer.writeLine(`validator.compile(schema)`);
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
});
|
|
253
|
+
sourceFile.addVariableStatement({
|
|
254
|
+
declarationKind: ts_morph_1.VariableDeclarationKind.Const,
|
|
255
|
+
isExported: true,
|
|
256
|
+
declarations: [
|
|
257
|
+
{
|
|
258
|
+
name: "isValidSchema",
|
|
259
|
+
initializer: (writer) => {
|
|
260
|
+
writer.writeLine(`<T extends keyof typeof schemas>(data: unknown, schemaKeyRef: T): data is ISchema[T] => {`);
|
|
261
|
+
writer.writeLine(`validator.validate(schemaKeyRef as string, data);`);
|
|
262
|
+
writer.writeLine(`return Boolean(validator.errors) === false;`);
|
|
263
|
+
writer.writeLine(`}`);
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
writeValidationTypesFile(typeInfos, outputFile) {
|
|
270
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
const sourceFile = this.project.createSourceFile(outputFile, {}, defaultCreateFileOptions);
|
|
272
|
+
const importMap = new Map();
|
|
273
|
+
// Sort typeInfos for consistent processing
|
|
274
|
+
const sortedTypeInfos = [...typeInfos].sort((a, b) => a.symbol.localeCompare(b.symbol));
|
|
275
|
+
sortedTypeInfos.forEach(({ symbol, importPath }) => {
|
|
276
|
+
const existing = importMap.get(importPath) || [];
|
|
277
|
+
existing.push(symbol);
|
|
278
|
+
importMap.set(importPath, existing);
|
|
279
|
+
});
|
|
280
|
+
// Sort import paths and symbols alphabetically
|
|
281
|
+
const sortedImportPaths = Array.from(importMap.keys()).sort();
|
|
282
|
+
sortedImportPaths.forEach((importPath) => {
|
|
283
|
+
const symbols = importMap.get(importPath).sort();
|
|
284
|
+
const declaration = sourceFile.addImportDeclaration({
|
|
285
|
+
moduleSpecifier: importPath
|
|
286
|
+
});
|
|
287
|
+
symbols.forEach((symbol) => {
|
|
288
|
+
declaration.addNamedImport({
|
|
289
|
+
name: symbol,
|
|
290
|
+
alias: `_${symbol}`
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
if (this.options.treeShaking) {
|
|
295
|
+
sortedTypeInfos.forEach(({ symbol }) => {
|
|
296
|
+
sourceFile.addTypeAlias({
|
|
297
|
+
name: symbol,
|
|
298
|
+
type: `_${symbol}`,
|
|
299
|
+
isExported: true
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
const namespace = sourceFile.addModule({
|
|
305
|
+
name: "ValidationType",
|
|
306
|
+
isExported: true,
|
|
307
|
+
});
|
|
308
|
+
sortedTypeInfos.forEach(({ symbol }) => {
|
|
309
|
+
namespace.addTypeAlias({
|
|
310
|
+
name: symbol,
|
|
311
|
+
type: `_${symbol}`,
|
|
312
|
+
isExported: true
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
yield this.project.save();
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
exports.CodeGenerator = CodeGenerator;
|
|
321
|
+
//# sourceMappingURL=CodeGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeGenerator.js","sourceRoot":"","sources":["../../src/services/CodeGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAUkB;AAElB,gDAAwB;AACxB,kDAA+C;AAC/C,sCAAgD;AAehD,MAAM,6BAA6B,GAAmB;IAClD,oBAAoB,EAAE;QAClB,eAAe,EAAE,0BAAe,CAAC,UAAU;QAC3C,WAAW,EAAE,sBAAW,CAAC,QAAQ;QACjC,SAAS,EAAE,oBAAS,CAAC,MAAM;QAC3B,+BAA+B,EAAE,KAAK;QACtC,iBAAiB,EAAE,IAAI;KAC1B;CACJ,CAAC;AAEF,MAAM,wBAAwB,GAA4B;IACtD,SAAS,EAAE,IAAI;CAClB,CAAC;AAEF,MAAa,aAAa;IAGtB,YAAoB,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;QAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAO,CAAC,6BAA6B,CAAC,CAAC;IAC9D,CAAC;IAEY,wBAAwB,CACjC,SAA8B,EAC9B,UAAkB;;YAElB,IAAI,CAAC;gBACD,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,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