"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const typeorm_1 = require("typeorm");
const entities_1 = require("../entities");
exports.headless = async ({ id = '', model = null } = {}) => {
    if (model) {
        if (typeof model == 'string') {
            model = JSON.parse(model);
        }
        else if (typeof model !== 'object') {
            throw 'model should be a string or object';
        }
    }
    else if (id) {
        const repository = typeorm_1.getRepository(entities_1.Board);
        const board = await repository.findOne({ id });
        model = JSON.parse(board.model);
    }
    else {
        throw 'parameter model or id mandatory';
    }
    return model;
};
//# sourceMappingURL=headless.js.map