Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (condition.cardinality) {
exitWithError("Unsupported condition: cardinality");
}
if (condition.reverseFlag) {
exitWithError("Unsupported condition: reverseFlag");
}
if (condition.typeId != "*") {
if (condition.attributeOperator) {
if (condition.attributeOperator == "descendantOrSelfOf") {
elemMatch["$or"] = [];
elemMatch["$or"].push({"type.conceptId" : condition.conceptId});
elemMatch["$or"].push({"typeInferredAncestors" : condition.conceptId});
} else if (condition.attributeOperator == "descendantOf") {
elemMatch["typeInferredAncestors"] = condition.conceptId;
} else {
elemMatch["type.conceptId"] = condition.typeId;
}
} else {
elemMatch["type.conceptId"] = condition.typeId;
}
}
// Process attribute value
//if (condition.targetNode.content != "*") {
// var temp = [];
// computer.resolve(condition.targetNode, ast, temp;
//}
//queryPart.push({relationships: {"$elemMatch": elemMatch}});
//TODO: update for nested definitions in attributes
if (condition.targetNode) {
if (condition.targetNode.rule == "simpleExpressionConstraint") {
var targetExp = readSimpleExpressionConstraint(condition.targetNode, ast);
//console.log(JSON.stringify(targetExp));
if (condition.reverseFlag) {
exitWithError("Unsupported condition: reverseFlag");
}
if (condition.typeId != "*") {
if (condition.attributeOperator) {
if (condition.attributeOperator == "descendantOrSelfOf") {
elemMatch["$or"] = [];
elemMatch["$or"].push({"type.conceptId" : condition.conceptId});
elemMatch["$or"].push({"typeInferredAncestors" : condition.conceptId});
} else if (condition.attributeOperator == "descendantOf") {
elemMatch["typeInferredAncestors"] = condition.conceptId;
} else {
elemMatch["type.conceptId"] = condition.typeId;
}
} else {
elemMatch["type.conceptId"] = condition.typeId;
}
}
// Process attribute value
//if (condition.targetNode.content != "*") {
// var temp = [];
// computer.resolve(condition.targetNode, ast, temp;
//}
//queryPart.push({relationships: {"$elemMatch": elemMatch}});
//TODO: update for nested definitions in attributes
if (condition.targetNode) {
if (condition.targetNode.rule == "simpleExpressionConstraint") {
var targetExp = readSimpleExpressionConstraint(condition.targetNode, ast);
//console.log(JSON.stringify(targetExp));
if (targetExp.memberOf) {
elemMatch["targetMemberships"] = targetExp.conceptId;
} else if (targetExp.criteria == "descendantOrSelfOf") {