31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.default = grabUserSchemaData;
|
|
const serverError_1 = __importDefault(require("./serverError"));
|
|
const fs_1 = __importDefault(require("fs"));
|
|
const grab_dir_names_1 = __importDefault(require("../../utils/backend/names/grab-dir-names"));
|
|
const ejson_1 = __importDefault(require("../../utils/ejson"));
|
|
/**
|
|
* # Grab User Schema Data
|
|
*/
|
|
function grabUserSchemaData({ userId, }) {
|
|
var _a;
|
|
try {
|
|
const { userSchemaMainJSONFilePath } = (0, grab_dir_names_1.default)({ userId });
|
|
const schemaJSON = fs_1.default.readFileSync(userSchemaMainJSONFilePath || "", "utf-8");
|
|
const schemaObj = ejson_1.default.parse(schemaJSON);
|
|
return schemaObj;
|
|
}
|
|
catch (error) {
|
|
(0, serverError_1.default)({
|
|
component: "grabUserSchemaData",
|
|
message: error.message,
|
|
});
|
|
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Grabbing User Schema Data`, error);
|
|
return null;
|
|
}
|
|
}
|