import { IGXE } from "@intelligentgraphics/igd.core";
/**
 * Checks wether the specified target exists inside the session. Throws an error if it doesn't
 *
 * @param {(ArticleQuery | Session)} articleQuery
 * @param {string | Article} target
 */
export var getArticleOrThrow = function (articleQuery, target) {
    var comId = typeof target === "string" ? target : target.comId;
    var article = articleQuery.getArticleByComId(comId);
    if (article === undefined) {
        throw new Error("Could not find an article for comId \"" + comId + "\"");
    }
    return article;
};
export var getPropertyValue = function (article, property, value) {
    var propertyDefinition = IGXE.findProperty(article.properties, property);
    if (propertyDefinition === undefined) {
        return undefined;
    }
    var valueDefinition = IGXE.findValueDefinition(propertyDefinition, value);
    return valueDefinition;
};
