Commit 6f938d50 authored by Corey Jepperson's avatar Corey Jepperson

childMap in q

parent ee9e0eb4
...@@ -296,7 +296,6 @@ module.exports = function restubFromBlQuery(params, cb){ ...@@ -296,7 +296,6 @@ module.exports = function restubFromBlQuery(params, cb){
allNewNodes.push({name:_path.join(curTargetPath, "bl:autoStubbed"), value: sourcePath}) allNewNodes.push({name:_path.join(curTargetPath, "bl:autoStubbed"), value: sourcePath})
} }
var templateContentResult = !slingTemplateContent ? templateContent({resourceType, targetPath: sourceMapping ? sourcePath : _path.join(targetPath, curTargetPath), prefix: curTargetPath + jcrContentNode, forceChildMap: querySpecification.childMap}) : ''; var templateContentResult = !slingTemplateContent ? templateContent({resourceType, targetPath: sourceMapping ? sourcePath : _path.join(targetPath, curTargetPath), prefix: curTargetPath + jcrContentNode, forceChildMap: querySpecification.childMap}) : '';
if(_.isArray(templateContentResult)){ if(_.isArray(templateContentResult)){
allNewNodes = allNewNodes.concat(templateContentResult); allNewNodes = allNewNodes.concat(templateContentResult);
......
...@@ -16,9 +16,9 @@ module.exports = function templateContent(options){ ...@@ -16,9 +16,9 @@ module.exports = function templateContent(options){
var result={"sling:resourceType":resourceType}; var result={"sling:resourceType":resourceType};
var template = null;
if(options.forceChildMap){ if(options.forceChildMap){
result["bl:map"] = options.forceChildMap; template = { "bl:map": options.forceChildMap };
}else{ }else{
var blMap = component.getComponentInheritSettings(); var blMap = component.getComponentInheritSettings();
...@@ -42,22 +42,26 @@ module.exports = function templateContent(options){ ...@@ -42,22 +42,26 @@ module.exports = function templateContent(options){
var pathRegex = []; var pathRegex = [];
if (blMap) {
_.each(blMap.exclude, (path)=>{ _.each(blMap.exclude, (path)=>{
var parts=path.split("/"); var parts=path.split("/");
parts.pop();
while(parts.length){
pathRegex.push( `^${prefixWithSlash}${parts.join("/")}/sling:resourceType` )
parts.pop(); parts.pop();
} while(parts.length){
pathRegex.push(`^${prefixWithSlash}${path}($|/)`); pathRegex.push( `^${prefixWithSlash}${parts.join("/")}/sling:resourceType` )
}); parts.pop();
}
pathRegex.push(`^${prefixWithSlash}${path}($|/)`);
});
}
pathRegex = pathRegex.join("|") + (pathRegex.length?"|":"") + "(^|/)bl:map/"; pathRegex = pathRegex.join("|") + (pathRegex.length?"|":"") + "(^|/)bl:map/";
pathRegex = new RegExp(pathRegex); pathRegex = new RegExp(pathRegex);
var flattenedTemplate = flatten(component.template, {prefix}); var flattenedTemplate = flatten(component.template, {prefix});
if (template) {
Object.assign(flattenedTemplate, flatten(template, {prefix}));
}
// TODO: How to get the parsys bl:dont-merge setting written to the REPO? // TODO: How to get the parsys bl:dont-merge setting written to the REPO?
// answer: the correct moment to write the parsys meta-setting to the repo is at "child component add" time. // answer: the correct moment to write the parsys meta-setting to the repo is at "child component add" time.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment