"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
const _serverconstants = require("../server.constants");
const _datasource = require("../data-source");
const _printerentity = require("../entities/printer.entity");
process.env[_serverconstants.AppConstants.DATABASE_FILE] = ":memory:";
async function main() {
    console.log("Running test sqlite with TypeORM");
    const ds = await _datasource.AppDataSource.initialize();
    const printerRepo = ds.getRepository(_printerentity.Printer);
    const entity = printerRepo.create({
        name: "Default Printer",
        printerUrl: "http://localhost:3000",
        apiKey: "1234567890"
    });
    await ds.transaction(async (manager)=>{
        const result = await manager.save(entity);
        const printer = await printerRepo.findOneByOrFail({
            id: result.id
        });
        console.log("Printer found", printer.id, printer.name, printer.printerUrl, printer.apiKey);
    });
}
main().then(()=>{
    console.log("Done!");
    process.exit(0);
});

//# sourceMappingURL=sqlite-torm.js.map