@autobe/compiler
Version:
AI backend server code generator
38 lines • 1.77 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AutoBePrismaCompiler = void 0;
const utils_1 = require("@autobe/utils");
const embed_prisma_1 = require("embed-prisma");
const validatePrismaApplication_1 = require("./validatePrismaApplication");
class AutoBePrismaCompiler {
compile(props) {
return __awaiter(this, void 0, void 0, function* () {
const compiler = new embed_prisma_1.EmbedPrisma();
return compiler.compile(props.files);
});
}
validate(application) {
return __awaiter(this, void 0, void 0, function* () {
return (0, validatePrismaApplication_1.validatePrismaApplication)(application);
});
}
write(application_1) {
return __awaiter(this, arguments, void 0, function* (application, dbms = "postgres") {
return (0, utils_1.writePrismaApplication)({
application,
dbms,
});
});
}
}
exports.AutoBePrismaCompiler = AutoBePrismaCompiler;
//# sourceMappingURL=AutoBePrismaCompiler.js.map