Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static async compile(target, ctoSystemFile, ctoFiles, output) {
const modelManager = await ModelLoader.loadModelManager(ctoSystemFile, ctoFiles);
let visitor = null;
switch(target) {
case 'Go':
visitor = new GoLangVisitor();
break;
case 'PlantUML':
visitor = new PlantUMLVisitor();
break;
case 'Typescript':
visitor = new TypescriptVisitor();
break;
case 'Java':
visitor = new JavaVisitor();
break;
static async validate(sample, ctoSystemFile, ctoFiles) {
const json = JSON.parse(fs.readFileSync(sample, 'utf8'));
const modelManager = await ModelLoader.loadModelManager(ctoSystemFile, ctoFiles);
const factory = new Factory(modelManager);
const serializer = new Serializer(factory, modelManager);
const object = serializer.fromJSON(json);
return JSON.stringify(serializer.toJSON(object));
}
static async get(ctoSystemFile, ctoFiles, output) {
const modelManager = await ModelLoader.loadModelManager(ctoSystemFile, ctoFiles);
mkdirp.sync(output);
modelManager.writeModelsToFileSystem(output);
return `Loaded external models in '${output}'.`;
}
}