"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRootIfPreferencesExist = void 0;
const solid_logic_1 = require("solid-logic");
const ns_1 = __importDefault(require("../../ns"));
// Will rename this file later. We will probably be using solid-logic anyway
// moved it out so I can mock
const getRootIfPreferencesExist = (webId) => {
    let root = solid_logic_1.store.any(webId, ns_1.default.space('preferencesFile'), null, webId.doc())?.value;
    root = root?.split('/').slice(0, -2).join('/');
    if (!root)
        throw new Error(`prefererencesFile is expected to exist in ${webId}`);
    return root;
};
exports.getRootIfPreferencesExist = getRootIfPreferencesExist;
//# sourceMappingURL=otherHelpers.js.map