@ind-rcg/modeler-sfdx-cli-plugin 246.1042.2 → 246.1046.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/utils/generateManifestHelper.js +1 -1
- package/lib/utils/templateEngine.js +1 -1
- package/lib/utils/xmlHelper.js +1 -0
- package/oclif.manifest.json +1 -1
- package/package.json +8 -9
- package/templates/contractTemplates/BL_BusinessLogic/${REFERENCE_OBJECT}.${NAME}.bl.js +53 -0
- package/templates/contractTemplates/BL_BusinessLogic/${REFERENCE_OBJECT}.${NAME}Async.bl.js +52 -0
- package/templates/contractTemplates/BL_BusinessLogic/BusinessLogic.md +4 -0
- package/templates/templateDefinitions.json +119 -0
package/README.md
CHANGED
|
@@ -8,12 +8,12 @@ This plugin is an enhancement of the sfdx cli and provide you features to custom
|
|
|
8
8
|
```sh
|
|
9
9
|
# Install the plugin on your local system
|
|
10
10
|
$ sf plugins install @ind-rcg/modeler-sfdx-cli-plugin
|
|
11
|
-
#
|
|
11
|
+
# --- OR ---
|
|
12
12
|
$ sfdx plugins install @ind-rcg/modeler-sfdx-cli-plugin
|
|
13
13
|
|
|
14
14
|
# Verify that installation was successful
|
|
15
15
|
$ sf plugins
|
|
16
|
-
#
|
|
16
|
+
# --- OR ---
|
|
17
17
|
$ sfdx plugins
|
|
18
18
|
# Output: @ind-rcg/modeler-sfdx-cli-plugin xxx.xxxx.x (x being the version number which was installed)
|
|
19
19
|
...
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFingerprints=void 0;const fsHelper_1=require("./fsHelper"),constants_1=require("../constants"),sha256=require("crypto-js/sha256"),encHex=require("crypto-js/enc-hex"),path=require("path"),walkSync=require("klaw-sync");function getFingerprints(e){const t={};return walkSync(e,{nodir:!0}).forEach((r=>{const s=path.relative(e,r.path).split(path.sep).join(path.posix.sep);if(s===constants_1.WorkspaceConstants.MANIFEST_FILE)return;const n=(0,fsHelper_1.readTextFile)(r.path);t[s]=sha256(n).toString(encHex)})),t}exports.getFingerprints=getFingerprints;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFingerprints=exports.DEFAULT_FINGERPRINT=exports.CORE_LOCALES=void 0;const fsHelper_1=require("./fsHelper"),constants_1=require("../constants"),sha256=require("crypto-js/sha256"),encHex=require("crypto-js/enc-hex"),path=require("path"),walkSync=require("klaw-sync");function getFingerprints(e){const t={};return walkSync(e,{nodir:!0}).forEach((r=>{const s=path.relative(e,r.path).split(path.sep).join(path.posix.sep);if(s===constants_1.WorkspaceConstants.MANIFEST_FILE)return;const n=(0,fsHelper_1.readTextFile)(r.path);t[s]=sha256(n).toString(encHex)})),exports.CORE_LOCALES.forEach((e=>{const r=["Locale",`${e}.locale.xml`].join(path.posix.sep);t[r]||(t[r]=exports.DEFAULT_FINGERPRINT)})),t}exports.CORE_LOCALES=["br","da","de","en","es","fi","fr","gb","hu","in","it","ja","ko","mx","nl","no","pt","ru","sv","th","tw","vi","zh"],exports.DEFAULT_FINGERPRINT="N.A.",exports.getFingerprints=getFingerprints;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TemplateEngine=exports.Utils=exports.TemplateEngineContext=exports.ValidationSet=exports.NON_MODULES=exports.TemplateEngineState=exports.ResourceType=exports.ContractType=exports.QuestionType=exports.Namespace=exports.NameIdentifier=void 0;const _=require("lodash"),inquirer=require("inquirer"),path=require("path"),walkSync=require("klaw-sync"),fsHelper_1=require("./fsHelper"),templateHelper_1=require("./templateHelper");var NameIdentifier,Namespace,QuestionType,ContractType;!function(e){e.Core="",e.Custom="My"}(NameIdentifier=exports.NameIdentifier||(exports.NameIdentifier={})),function(e){e.Core="CORE",e.Custom="CUSTOM"}(Namespace=exports.Namespace||(exports.Namespace={})),function(e){e.Type="TYPE",e.Name="NAME",e.Module="MODULE",e.FullName="FULL_NAME",e.Option="OPTION",e.Confirmation="CONFIRMATION"}(QuestionType=exports.QuestionType||(exports.QuestionType={})),function(e){e.Module="module",e.BusinessObject="businessobject",e.ListObject="listobject",e.LookupObject="lookupobject",e.DataSource="datasource"}(ContractType=exports.ContractType||(exports.ContractType={}));const ContractTypes=[ContractType.Module,ContractType.BusinessObject,ContractType.ListObject,ContractType.LookupObject,ContractType.DataSource];var ResourceType,TemplateEngineState;!function(e){e.File="file",e.Folder="folder",e.Tree="tree"}(ResourceType=exports.ResourceType||(exports.ResourceType={})),function(e){e[e.NEW=0]="NEW",e[e.DONE=1]="DONE",e[e.FAILED=2]="FAILED",e[e.ABORTED=3]="ABORTED"}(TemplateEngineState=exports.TemplateEngineState||(exports.TemplateEngineState={})),exports.NON_MODULES=["Application","BusinessObjectHelpers","ExternalFiles","Images","Locale","Plugins","SharedWebData","UI Plugins"];class ValidationSet{constructor(e){this.validations=e}validate(e){let t=!0;return _.forEach(this.validations,(r=>{let s=r(e);_.isBoolean(s)||!s||(t=s)})),t}}exports.ValidationSet=ValidationSet;class TemplateEngineContext{constructor(e){this.resourceTemplateDefinition=this.__loadResourceTemplateDefinition(),this.resourceOptions=this.__createResourceOptionsMap(),this.workspace=e}__loadResourceTemplateDefinition(){return(0,fsHelper_1.readJsonFile)((0,templateHelper_1.getTemplateDefinitionsFilePath)())}__createResourceOptionsMap(){let e=new Map;return _.forIn(this.resourceTemplateDefinition,(t=>{let r=t;_.forEach(r.options,(t=>{let r=t;e.set(r.name,r)}))})),e}getResourceTemplateTypes(){return ContractTypes}getResourceTemplateTypeData(e){return this.resourceTemplateDefinition[e]}getResourceTemplateOption(e){return this.resourceOptions.get(e)}getWorkspace(){return this.workspace}getModules(){let e=this.workspace.getSourcePath(),t=walkSync(e,{depthLimit:0,nofile:!0}),r=_.map(t,(t=>path.relative(e,t.path)));return _.without(r,...exports.NON_MODULES)}getWorkspaceParameters(){return{CUSTOM:this.workspace.isProjectWorkspace()?NameIdentifier.Custom:NameIdentifier.Core,NAMESPACE:this.workspace.isProjectWorkspace()?Namespace.Custom:Namespace.Core}}getResourceName(e,t,r){let s;switch(e){case ContractType.BusinessObject:case ContractType.ListObject:case ContractType.LookupObject:s=`${r}${t}`;break;case ContractType.DataSource:s=r===NameIdentifier.Custom&&t.indexOf(r)>=0?t:`${r}${t}`;break;default:s=`${t}`}return s}}exports.TemplateEngineContext=TemplateEngineContext;class Utils{static parseStringEnumValue(e,t){let r=Object.keys(t).find((r=>t[r]===e));return t[r]}}exports.Utils=Utils;class TemplateEngine{constructor(e){this.context=new TemplateEngineContext(e)}getResourceTypeOptions(e){return _.map(e,(e=>e.name))}convertAnswersToParameters(e){let t={};return _.forIn(e,((e,r)=>{t[r.toUpperCase()]=e})),t}evaluateFunctionSpec(e,t){let r=e.fn,s=e.args;s=_.map(s,(e=>this.replaceTemplateParameters(e,t)));let a=this.context[r].apply(this.context,s);return e.allowNone&&_.isArrayLike(a)&&a.push({name:"(none)",value:""}),a}resolveParameter(e,t){let r;return r="string"==typeof e?this.replaceTemplateParameters(e,t):this.evaluateFunctionSpec(e,t),r}resolveOptionParameters(e,t){_.isNil(e)||_.forIn(e,((e,r)=>{let s=this.resolveParameter(e,t);t[r]=s}))}resolveReturnParameters(e,t){if(!_.isNil(e)){let r=this.setupParameters(e,t);_.merge(e,r)}}setupParameters(e,t){let r={};return _.isNil(e)||_.forIn(e,((e,s)=>{let a=this.resolveParameter(e,t);r[s]=a})),r}replaceTemplateParameters(e,t){let r=e;return _.forIn(t,((e,t)=>{if("string"==typeof e){let s=new RegExp(_.join(["\\${",t,"}"],""),"gm"),a=e;r=_.replace(r,s,a)}})),r}expandResources(e){let t=[];return _.forEach(e,(e=>{switch(e.type){case ResourceType.File:this.expandFileResource(e,t);break;case ResourceType.Folder:this.expandFolderResource(e,t);break;case ResourceType.Tree:this.expandTreeResource(e,t)}})),t}resolveResources(e,t){let r=[];return _.forEach(e,(e=>{let s=_.clone(e);s.target=this.replaceTemplateParameters(s.target,t),s.type===ResourceType.File&&this.loadResourceFileData(s,t),r.push(s)})),r}getResourceSourcePath(e){return e&&e.source?(0,fsHelper_1.joinPaths)((0,templateHelper_1.getContractTemplatesPath)(),e.source):null}getResourceTargetPath(e){return(0,fsHelper_1.joinPaths)(this.context.getWorkspace().getSourcePath(),e.target)}loadResourceFileData(e,t){if(e.type===ResourceType.File){let r=(0,fsHelper_1.readTextFile)(e.source);r=this.replaceTemplateParameters(r,t),e.data=r}}createResource(e,t,r){return{type:e,source:t,target:r}}expandFileResource(e,t){let r=this.createResource(ResourceType.File,this.getResourceSourcePath(e),this.getResourceTargetPath(e));t.push(r)}expandFolderResource(e,t){let r=this.createResource(ResourceType.Folder,this.getResourceSourcePath(e),this.getResourceTargetPath(e));t.push(r)}expandTreeResource(e,t){let r=this.getResourceSourcePath(e),s=this.getResourceTargetPath(e);this.expandFolderResource(e,t);let a=walkSync(r,{filter:e=>!e.stats.isFile()||!e.path.endsWith(".md")});_.forEach(a,(e=>{let a;e.stats.isFile()?a=ResourceType.File:e.stats.isDirectory()&&(a=ResourceType.Folder);let o=e.path,i=(0,fsHelper_1.joinPaths)(s,path.relative(r,e.path)),n=this.createResource(a,o,i);t.push(n)}))}createResources(e){_.forEach(e,(e=>{e.type===ResourceType.File?(0,fsHelper_1.ensureFileExists)(e.target,e.data):(0,fsHelper_1.ensureFolderExists)(e.target)}))}canCreateResources(e,t){let r=!0,s=null,a=_.filter(e,(e=>e.type===ResourceType.File));return _.forEach(a,(e=>{if(r&&(0,fsHelper_1.existsFile)(e.target)){r=!1,s=_.first(a).target;let e=(0,fsHelper_1.parentPath)(this.context.getWorkspace().getBasePath());switch(t){case ContractType.BusinessObject:case ContractType.ListObject:case ContractType.LookupObject:s=(0,fsHelper_1.parentPath)(s);case ContractType.DataSource:}s=(0,fsHelper_1.relativePath)(e,s)}})),{success:r,path:s}}async processResourceOption(e,t,r,s){let a=!1;_.isNil(r)&&(a=!0,r=[]);let o={option:e,main:a,parameters:null,resources:null},i=_.clone(t);_.isNil(s)||(i=_.merge(i,s));let n=this.convertAnswersToParameters(i);n=_.merge(n,this.context.getWorkspaceParameters()),this.resolveOptionParameters(e.parameters,n),this.resolveReturnParameters(e.returnParameters,n);let p=this.expandResources(e.resources);if(o.parameters=n,o.resources=p,r.push(o),e?.includes)for(let t=0;t<e.includes.length;t++){const s=e.includes[t];let a=s.name,p=this.context.getResourceTemplateOption(a),c=this.setupParameters(s?.parameters,n);await this.processResourceOption(p,i,r,c),p?.returnParameters&&(o.parameters=_.merge(o.parameters,p.returnParameters))}if(o.main){let e=[];_.forEach(r,(t=>{const r=this.resolveResources(t.resources,t.parameters);e=e.concat(r)})),p=e}return{resources:p,parameters:n}}validateName(e){let t=[];t.push((e=>!(e.length<3||e.length>26)||"Use a minimum of 3 and a maximum of 26 characters containing alphanumeric and the underscore symbol.")),t.push((e=>!!new RegExp("^[a-zA-Z0-9_]+$","g").test(e)||"Use alphanumeric characters and the underscore symbol.")),t.push((e=>!new RegExp(NameIdentifier.Custom,"gi").test(e)||`Avoid using '${NameIdentifier.Custom}' in name value.`));let r=new ValidationSet(t);return r.validate.bind(r)}async askForResourceType(e,t){return inquirer.prompt([{name:QuestionType.Type,message:"Select the resource you want to add.",type:"list",choices:e}],t)}async askForResourceName(e){let t=_.get(e,QuestionType.Type);return inquirer.prompt([{name:QuestionType.Name,message:`Specify a name for the ${t}:`,type:"input",validate:this.validateName(t)}],e)}async askForModule(e,t){let r=_.get(t,QuestionType.Name),s=_.get(t,QuestionType.Type);return inquirer.prompt([{name:QuestionType.Module,message:`Select the module to which ${s} '${r}' should be added.`,type:"list",choices:e}],t)}async askForOption(e,t){let r=_.get(t,QuestionType.Name),s=_.get(t,QuestionType.Type);return inquirer.prompt([{name:QuestionType.Option,message:`Select a suitable option for ${s} '${r}'.`,type:"list",choices:e}],t)}async askForConfirmation(e){let t=_.get(e,QuestionType.Name),r=_.get(e,QuestionType.Type);return inquirer.prompt([{name:QuestionType.Confirmation,message:`Do you really want to create the ${r} '${t}'?`,type:"confirm"}],e)}async processRequest(e){let t={State:TemplateEngineState.NEW,Message:"",Type:"",Name:"",Files:[]};try{let r=await this.askForResourceType(this.context.getResourceTemplateTypes(),e);r=await this.askForResourceName(r);let s=_.get(r,QuestionType.Type),a=Utils.parseStringEnumValue(s,ContractType),o=this.context.getResourceTemplateTypeData(a);if(o){!0===o.moduleRequired&&(r=await this.askForModule(this.context.getModules(),r));let e,s=o.options;if(1===s.length){let e={};e[QuestionType.Option]=s[0].name,r=_.merge(r,e)}r=await this.askForOption(this.getResourceTypeOptions(s),r);let a=_.get(r,QuestionType.Option);e=this.context.getResourceTemplateOption(a);let i=await this.processResourceOption(e,r),n=_.get(i.parameters,QuestionType.FullName,"");_.isEmpty(n)&&(n=_.get(i.parameters,QuestionType.Name));let p=_.get(i.parameters,QuestionType.Type);t.Name=n,t.Type=p;let c=this.canCreateResources(i.resources,p);if(c.success){r=await this.askForConfirmation(r),!0===_.get(r,QuestionType.Confirmation)?(this.createResources(i.resources),t.State=TemplateEngineState.DONE,t.Files=_.compact(_.map(i.resources,(e=>{if(e.type===ResourceType.File)return e.target})))):t.State=TemplateEngineState.ABORTED}else t.State=TemplateEngineState.FAILED,t.Message=`The ${p} '${n}' already exists at ${c.path}. To create a new ${p}, re-run the command and specify a unique name.`}}catch(e){t.State=TemplateEngineState.FAILED,t.Message=e.toString()}return t}}exports.TemplateEngine=TemplateEngine;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TemplateEngine=exports.Utils=exports.TemplateEngineContext=exports.ValidationSet=exports.NON_MODULES=exports.TemplateEngineState=exports.ResourceType=exports.ResourceAction=exports.ContractType=exports.QuestionType=exports.Namespace=exports.NameIdentifier=void 0;const _=require("lodash"),inquirer=require("inquirer"),path=require("path"),walkSync=require("klaw-sync"),fsHelper_1=require("./fsHelper"),templateHelper_1=require("./templateHelper"),xmlHelper_1=require("./xmlHelper");var NameIdentifier,Namespace,QuestionType,ContractType;!function(e){e.Core="",e.Custom="My"}(NameIdentifier=exports.NameIdentifier||(exports.NameIdentifier={})),function(e){e.Core="CORE",e.Custom="CUSTOM"}(Namespace=exports.Namespace||(exports.Namespace={})),function(e){e.Type="TYPE",e.Name="NAME",e.Module="MODULE",e.FullName="FULL_NAME",e.Option="OPTION",e.Confirmation="CONFIRMATION"}(QuestionType=exports.QuestionType||(exports.QuestionType={})),function(e){e.Module="module",e.BusinessObject="businessobject",e.ListObject="listobject",e.LookupObject="lookupobject",e.DataSource="datasource",e.BusinessLogic="businesslogic"}(ContractType=exports.ContractType||(exports.ContractType={}));const ContractTypes=[ContractType.Module,ContractType.BusinessObject,ContractType.ListObject,ContractType.LookupObject,ContractType.DataSource,ContractType.BusinessLogic];var ResourceAction,ResourceType,TemplateEngineState;!function(e){e.Add="add",e.Update="update"}(ResourceAction=exports.ResourceAction||(exports.ResourceAction={})),function(e){e.File="file",e.Folder="folder",e.Tree="tree"}(ResourceType=exports.ResourceType||(exports.ResourceType={})),function(e){e[e.NEW=0]="NEW",e[e.DONE=1]="DONE",e[e.FAILED=2]="FAILED",e[e.ABORTED=3]="ABORTED"}(TemplateEngineState=exports.TemplateEngineState||(exports.TemplateEngineState={})),exports.NON_MODULES=["Application","BusinessObjectHelpers","ExternalFiles","Images","Locale","Plugins","SharedWebData","UI Plugins"];class ValidationSet{constructor(e){this.validations=e}validate(e){let t=!0;return _.forEach(this.validations,(r=>{let s=r(e);_.isBoolean(s)||!s||(t=s)})),t}}exports.ValidationSet=ValidationSet;class TemplateEngineContext{constructor(e){this.resourceTemplateDefinition=this.__loadResourceTemplateDefinition(),this.resourceOptions=this.__createResourceOptionsMap(),this.workspace=e}__loadResourceTemplateDefinition(){return(0,fsHelper_1.readJsonFile)((0,templateHelper_1.getTemplateDefinitionsFilePath)())}__createResourceOptionsMap(){let e=new Map;return _.forIn(this.resourceTemplateDefinition,(t=>{let r=t;_.forEach(r.options,(t=>{let r=t;e.set(r.name,r)}))})),e}getResourceTemplateTypes(){return ContractTypes}getResourceTemplateTypeData(e){return this.resourceTemplateDefinition[e]}getResourceTemplateOption(e){return this.resourceOptions.get(e)}getWorkspace(){return this.workspace}getModules(){let e=this.workspace.getSourcePath(),t=walkSync(e,{depthLimit:0,nofile:!0}),r=_.map(t,(t=>path.relative(e,t.path)));return _.without(r,...exports.NON_MODULES)}getReferenceObjects(e){let t=this.workspace.getSourcePath(),r=(0,fsHelper_1.joinPaths)(t,e,"BO"),s=[];return(0,fsHelper_1.existsFolder)(r)&&(s=walkSync(r,{depthLimit:0,nofile:!0})),_.map(s,(e=>path.relative(r,e.path)))}getWorkspaceParameters(){return{CUSTOM:this.workspace.isProjectWorkspace()?NameIdentifier.Custom:NameIdentifier.Core,NAMESPACE:this.workspace.isProjectWorkspace()?Namespace.Custom:Namespace.Core}}getResourceName(e,t,r){let s;switch(e){case ContractType.BusinessObject:case ContractType.ListObject:case ContractType.LookupObject:case ContractType.BusinessLogic:s=`${r}${t}`;break;case ContractType.DataSource:s=r===NameIdentifier.Custom&&t.indexOf(r)>=0?t:`${r}${t}`;break;default:s=`${t}`}return s}getMethodName(e){return _.lowerFirst(e)}getMethodFileName(e){return _.upperFirst(e)}getReferenceObjectMethodFolder(e,t){let r,s=this.workspace.getSourcePath(),a=(0,fsHelper_1.joinPaths)(s,e,"BO",t);return r=(0,fsHelper_1.existsFolder)((0,fsHelper_1.joinPaths)(a,"Mv1"))?"Mv1":"Mv2",r}getReferenceObjectBaseType(e){let t;return t=e.startsWith("Lo")?ContractType.ListObject:e.startsWith("Lu")?ContractType.LookupObject:ContractType.BusinessObject,t}}exports.TemplateEngineContext=TemplateEngineContext;class Utils{static parseStringEnumValue(e,t){let r=Object.keys(t).find((r=>t[r]===e));return t[r]}}exports.Utils=Utils;class TemplateEngine{constructor(e){this.context=new TemplateEngineContext(e)}getResourceTypeOptions(e){return _.map(e,(e=>e.name))}convertAnswersToParameters(e){let t={};return _.forIn(e,((e,r)=>{t[r.toUpperCase()]=e})),t}evaluateFunctionSpec(e,t){let r=e.fn,s=e.args;s=_.map(s,(e=>this.replaceTemplateParameters(e,t)));let a=this.context[r].apply(this.context,s);return e.allowNone&&_.isArrayLike(a)&&a.push({name:"(none)",value:""}),a}resolveParameter(e,t){let r;return r="string"==typeof e?this.replaceTemplateParameters(e,t):this.evaluateFunctionSpec(e,t),r}resolveOptionParameters(e,t){_.isNil(e)||_.forIn(e,((e,r)=>{let s=this.resolveParameter(e,t);t[r]=s}))}resolveReturnParameters(e,t){if(!_.isNil(e)){let r=this.setupParameters(e,t);_.merge(e,r)}}setupParameters(e,t){let r={};return _.isNil(e)||_.forIn(e,((e,s)=>{let a=this.resolveParameter(e,t);r[s]=a})),r}replaceTemplateParameters(e,t){let r=e;return _.forIn(t,((e,t)=>{if("string"==typeof e){let s=new RegExp(_.join(["\\${",t,"}"],""),"gm"),a=e;r=_.replace(r,s,a)}})),r}expandResources(e){let t=[];return _.forEach(e,(e=>{switch(e.type){case ResourceType.File:this.expandFileResource(e,t);break;case ResourceType.Folder:this.expandFolderResource(e,t);break;case ResourceType.Tree:this.expandTreeResource(e,t)}})),t}resolveResources(e,t){let r=[];return _.forEach(e,(e=>{let s=_.clone(e);s.target=this.replaceTemplateParameters(s.target,t),s.type===ResourceType.File&&this.prepareResourceFileData(s,t),r.push(s)})),r}getResourceSourcePath(e){return e&&e.source?(0,fsHelper_1.joinPaths)((0,templateHelper_1.getContractTemplatesPath)(),e.source):null}getResourceTargetPath(e){return(0,fsHelper_1.joinPaths)(this.context.getWorkspace().getSourcePath(),e.target)}prepareResourceFileData(e,t){if(e.type===ResourceType.File){let r;if(e.action===ResourceAction.Add)r=(0,fsHelper_1.readTextFile)(e.source);else if(e.action===ResourceAction.Update){let s=path.basename(e.target);if(r=(0,fsHelper_1.readTextFile)(e.target),!r)return e.state.error=!0,void(e.state.message=`Error loading '${s}' contract for XML templating.`);let a=e.tpl;if(a){a.data=this.replaceTemplateParameters(a.data,t);try{r=(0,xmlHelper_1.applyXmlTemplating)(a,r)}catch(t){let r="";t&&(r=t.message),e.state.error=!0,e.state.message=`Error during XML templating of '${s}' contract${_.isEmpty(r)?"":" -> "}${r}`}}}r=this.replaceTemplateParameters(r,t),e.data=r}}createResource(e,t,r,s){return{type:e,action:t,state:{error:!1,message:""},source:r,target:s}}expandFileResource(e,t){let r=Object.assign({},e,{action:e.action||ResourceAction.Add,state:{error:!1,message:""},source:this.getResourceSourcePath(e),target:this.getResourceTargetPath(e)});t.push(r)}expandFolderResource(e,t){let r=this.createResource(ResourceType.Folder,ResourceAction.Add,this.getResourceSourcePath(e),this.getResourceTargetPath(e));t.push(r)}expandTreeResource(e,t){let r=this.getResourceSourcePath(e),s=this.getResourceTargetPath(e);this.expandFolderResource(e,t);let a=walkSync(r,{filter:e=>!e.stats.isFile()||!e.path.endsWith(".md")});_.forEach(a,(e=>{let a;e.stats.isFile()?a=ResourceType.File:e.stats.isDirectory()&&(a=ResourceType.Folder);let o=e.path,i=(0,fsHelper_1.joinPaths)(s,path.relative(r,e.path)),n=this.createResource(a,ResourceAction.Add,o,i);t.push(n)}))}createResources(e){_.forEach(e,(e=>{switch(e.action||ResourceAction.Add){case ResourceAction.Add:e.type===ResourceType.File?(0,fsHelper_1.ensureFileExists)(e.target,e.data):(0,fsHelper_1.ensureFolderExists)(e.target);break;case ResourceAction.Update:e.type===ResourceType.File&&(0,fsHelper_1.writeFile)(e.target,e.data)}}))}canCreateResources(e,t,r){let s=!0,a=null,o=_.filter(e,(e=>e?.state.error));if(_.isEmpty(o)){let o=_.filter(e,(e=>e.type===ResourceType.File&&e.action===ResourceAction.Add)),i=null;_.forEach(o,(e=>{if(s&&(0,fsHelper_1.existsFile)(e.target)){s=!1,i=_.first(o).target;let e=(0,fsHelper_1.parentPath)(this.context.getWorkspace().getBasePath());switch(t){case ContractType.BusinessObject:case ContractType.ListObject:case ContractType.LookupObject:i=(0,fsHelper_1.parentPath)(i);case ContractType.DataSource:case ContractType.BusinessLogic:}i=(0,fsHelper_1.relativePath)(e,i)}})),s||(a=`The ${t} '${r}' already exists at ${i}. To create a new ${t}, re-run the command and specify a unique name.`)}else s=!1,a=_.join(_.map(o,(e=>e?.state.message)),"\n");return{success:s,message:a}}async processResourceOption(e,t,r,s){let a=!1;_.isNil(r)&&(a=!0,r=[]);let o={option:e,main:a,parameters:null,resources:null},i=_.clone(t);_.isNil(s)||(i=_.merge(i,s)),e?.questions&&(i=await this.askAdditionalQuestions(e.questions,i));let n=this.convertAnswersToParameters(i);n=_.merge(n,this.context.getWorkspaceParameters()),this.resolveOptionParameters(e.parameters,n),this.resolveReturnParameters(e.returnParameters,n);let p=this.expandResources(e.resources);if(o.parameters=n,o.resources=p,r.push(o),e?.includes)for(let t=0;t<e.includes.length;t++){const s=e.includes[t];let a=s.name,p=this.context.getResourceTemplateOption(a),c=this.setupParameters(s?.parameters,n);await this.processResourceOption(p,i,r,c),p?.returnParameters&&(o.parameters=_.merge(o.parameters,p.returnParameters))}if(o.main){let e=[];_.forEach(r,(t=>{const r=this.resolveResources(t.resources,t.parameters);e=e.concat(r)})),p=e}return{resources:p,parameters:n}}validateName(e){let t=[];t.push((e=>!(e.length<3||e.length>26)||"Use a minimum of 3 and a maximum of 26 characters containing alphanumeric and the underscore symbol.")),t.push((e=>!!new RegExp("^[a-zA-Z0-9_]+$","g").test(e)||"Use alphanumeric characters and the underscore symbol.")),t.push((e=>!new RegExp(NameIdentifier.Custom,"gi").test(e)||`Avoid using '${NameIdentifier.Custom}' in name value.`));let r=new ValidationSet(t);return r.validate.bind(r)}async askForResourceType(e,t){return inquirer.prompt([{name:QuestionType.Type,message:"Select the resource you want to add.",type:"list",choices:e}],t)}async askForResourceName(e){let t=_.get(e,QuestionType.Type);return inquirer.prompt([{name:QuestionType.Name,message:`Specify a name for the ${t}:`,type:"input",validate:this.validateName(t)}],e)}async askForModule(e,t){let r=_.get(t,QuestionType.Name),s=_.get(t,QuestionType.Type);return inquirer.prompt([{name:QuestionType.Module,message:`Select the module to which ${s} '${r}' should be added.`,type:"list",choices:e}],t)}async askForOption(e,t){let r=_.get(t,QuestionType.Name),s=_.get(t,QuestionType.Type);return inquirer.prompt([{name:QuestionType.Option,message:`Select a suitable option for ${s} '${r}'.`,type:"list",choices:e}],t)}buildOptionQuestions(e,t){let r=_.cloneDeep(e),s=this.convertAnswersToParameters(t);return _.forEach(r,(e=>{e.choices=this.evaluateFunctionSpec(e.choices,s)})),r}async askAdditionalQuestions(e,t){let r=this.buildOptionQuestions(e,t);return inquirer.prompt(r,t)}async askForConfirmation(e){let t=_.get(e,QuestionType.Name),r=_.get(e,QuestionType.Type);return inquirer.prompt([{name:QuestionType.Confirmation,message:`Do you really want to create the ${r} '${t}'?`,type:"confirm"}],e)}async processRequest(e){let t={State:TemplateEngineState.NEW,Message:"",Type:"",Name:"",Files:[]};try{let r=await this.askForResourceType(this.context.getResourceTemplateTypes(),e);r=await this.askForResourceName(r);let s=_.get(r,QuestionType.Type),a=Utils.parseStringEnumValue(s,ContractType),o=this.context.getResourceTemplateTypeData(a);if(o){!0===o.moduleRequired&&(r=await this.askForModule(this.context.getModules(),r));let e,s=o.options;if(1===s.length){let e={};e[QuestionType.Option]=s[0].name,r=_.merge(r,e)}r=await this.askForOption(this.getResourceTypeOptions(s),r);let a=_.get(r,QuestionType.Option);e=this.context.getResourceTemplateOption(a);let i=await this.processResourceOption(e,r),n=_.get(i.parameters,QuestionType.FullName,"");_.isEmpty(n)&&(n=_.get(i.parameters,QuestionType.Name));let p=_.get(i.parameters,QuestionType.Type);t.Name=n,t.Type=p;let c=this.canCreateResources(i.resources,p,n);if(c.success){r=await this.askForConfirmation(r),!0===_.get(r,QuestionType.Confirmation)?(this.createResources(i.resources),t.State=TemplateEngineState.DONE,t.Files=_.compact(_.map(i.resources,(e=>{if(e.type===ResourceType.File)return e.target})))):t.State=TemplateEngineState.ABORTED}else t.State=TemplateEngineState.FAILED,t.Message=c.message}}catch(e){t.State=TemplateEngineState.FAILED,t.Message=e.toString()}return t}}exports.TemplateEngine=TemplateEngine;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";let libxmljs;var XmlTemplatingError;function applyXmlTemplating(r,l){libxmljs||(libxmljs=require("libxmljs"));let t,e,m,o=null;try{t=libxmljs.parseXmlString(l)}catch(r){throw new Error(XmlTemplatingError.XML_DOCUMENT_PARSING_ERROR)}try{if(e=t.get(r.xpath),!e)throw new Error}catch(r){throw new Error(XmlTemplatingError.XML_ELEMENT_LOOKUP_ERROR)}try{m=libxmljs.parseXmlString(r.data)}catch(r){throw new Error(XmlTemplatingError.XML_FRAGMENT_PARSING_ERROR)}try{e.addChild(m.root()),o=t.root().toString({declaration:!1,selfCloseEmpty:!0,whitespace:!1,type:"xml"})}catch(r){throw new Error(XmlTemplatingError.XML_MANIPULATION_ERROR)}return o}Object.defineProperty(exports,"__esModule",{value:!0}),exports.applyXmlTemplating=exports.XmlTemplatingError=void 0,function(r){r.XML_DOCUMENT_PARSING_ERROR="Error parsing xmlDocument.",r.XML_ELEMENT_LOOKUP_ERROR="Error getting xmlElement.",r.XML_FRAGMENT_PARSING_ERROR="Error parsing xmlFragment.",r.XML_MANIPULATION_ERROR="Error adding xmlFragment to xmlElement."}(XmlTemplatingError=exports.XmlTemplatingError||(exports.XmlTemplatingError={})),exports.applyXmlTemplating=applyXmlTemplating;
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ind-rcg/modeler-sfdx-cli-plugin",
|
|
3
3
|
"displayName": "modeler-sfdx-cli-plugin",
|
|
4
|
-
"version": "246.
|
|
4
|
+
"version": "246.1046.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"description": "This plugin is an enhancement of the sfdx cli and provide you features to customize the Consumer Goods Cloud Mobility application. This version will be the replacement for the Consumer Goods Mobile Modeler which was hosted on a Windows Server machine.",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@ind-rcg/backend": "246.1008.0",
|
|
10
|
-
"@ind-rcg/framework": "246.
|
|
11
|
-
"@ind-rcg/generator": "246.
|
|
10
|
+
"@ind-rcg/framework": "246.1015.0",
|
|
11
|
+
"@ind-rcg/generator": "246.1019.0",
|
|
12
12
|
"@oclif/core": "2.9.4",
|
|
13
13
|
"@salesforce/core": "4.1.0",
|
|
14
14
|
"@salesforce/sf-plugins-core": "3.1.3",
|
|
@@ -19,14 +19,12 @@
|
|
|
19
19
|
"jszip": "3.10.1",
|
|
20
20
|
"klaw-sync": "6.0.0",
|
|
21
21
|
"latest-version": "7.0.0",
|
|
22
|
+
"libxmljs": "0.19.10",
|
|
22
23
|
"lodash": "4.17.21",
|
|
23
24
|
"rxjs": "5.4.1",
|
|
24
25
|
"tree-kill": "1.2.2",
|
|
25
26
|
"tslib": "2.4.0"
|
|
26
27
|
},
|
|
27
|
-
"resolutions": {
|
|
28
|
-
"@ind-rcg/plugins-printengine": "246.1010.0"
|
|
29
|
-
},
|
|
30
28
|
"devDependencies": {
|
|
31
29
|
"@istanbuljs/nyc-config-typescript": "1.0.2",
|
|
32
30
|
"@oclif/test": "2.1.1",
|
|
@@ -35,6 +33,7 @@
|
|
|
35
33
|
"@types/chai": "4.3.3",
|
|
36
34
|
"@types/fs-extra": "9.0.13",
|
|
37
35
|
"@types/klaw-sync": "6.0.1",
|
|
36
|
+
"@types/libxmljs": "0.18.8",
|
|
38
37
|
"@types/mocha": "8.2.3",
|
|
39
38
|
"@typescript-eslint/eslint-plugin": "5.31.0",
|
|
40
39
|
"@typescript-eslint/parser": "5.31.0",
|
|
@@ -95,14 +94,14 @@
|
|
|
95
94
|
"test-all": "nyc mocha --extension .ts --require ts-node/register --forbid-only \"test/**/*.test.ts\" \"test/**/*.test.nut.ts\"",
|
|
96
95
|
"test-unit": "nyc mocha --extension .ts --require ts-node/register --forbid-only \"test/**/*.test.ts\"",
|
|
97
96
|
"test-nut": "nyc mocha --extension .ts --require ts-node/register --forbid-only \"test/**/*.test.nut.ts\"",
|
|
98
|
-
"test-single": "nyc mocha --extension .ts --require ts-node/register --forbid-only \"test/**/
|
|
97
|
+
"test-single": "nyc mocha --extension .ts --require ts-node/register --forbid-only \"test/**/xmlHelper.test.ts\"",
|
|
99
98
|
"posttest": "yarn lint",
|
|
100
99
|
"version": "oclif readme && git add README.md",
|
|
101
100
|
"readme": "oclif readme",
|
|
102
101
|
"uglify": "uglifyjs-folder lib -e -x .js -o lib --log-level error"
|
|
103
102
|
},
|
|
104
103
|
"sfdx": {
|
|
105
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@ind-rcg/modeler-sfdx-cli-plugin/246.
|
|
106
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@ind-rcg/modeler-sfdx-cli-plugin/246.
|
|
104
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@ind-rcg/modeler-sfdx-cli-plugin/246.1046.0.crt",
|
|
105
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@ind-rcg/modeler-sfdx-cli-plugin/246.1046.0.sig"
|
|
107
106
|
}
|
|
108
107
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
4
|
+
// IMPORTANT - DO NOT MODIFY AUTO-GENERATED CODE OR COMMENTS //
|
|
5
|
+
//Parts of this file are auto-generated and modifications to those sections will be //
|
|
6
|
+
//overwritten. You are allowed to modify: //
|
|
7
|
+
// - the tags in the jsDoc as described in the corresponding section //
|
|
8
|
+
// - the function name and its parameters //
|
|
9
|
+
// - the function body between the insertion ranges //
|
|
10
|
+
// "Add your customizing javaScript code below / above" //
|
|
11
|
+
// //
|
|
12
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Use the following jsDoc tags to describe the BL function. Setting these tags will
|
|
16
|
+
* change the runtime behavior in the mobile app. The values specified in the tags determine
|
|
17
|
+
* the name of the contract file. The filename format is “@this . @function .bl.js”.
|
|
18
|
+
* For example, LoVisit.BeforeLoadAsync.bl.js
|
|
19
|
+
* -> function: Name of the businessLogic function.
|
|
20
|
+
* -> this: The LO, BO, or LU object that this function belongs to (and it is part of the filename).
|
|
21
|
+
* -> kind: Type of object this function belongs to. Most common value is "businessobject".
|
|
22
|
+
* -> async: If declared as async then the function should return a promise.
|
|
23
|
+
* -> param: List of parameters the function accepts. Make sure the parameters match the function signature.
|
|
24
|
+
* -> namespace: Use CORE or CUSTOM. If you are a Salesforce client or an implementation partner, always use CUSTOM to enable a seamless release upgrade.
|
|
25
|
+
* -> extends: Base class of the LO, BO, and LU objects that this function belongs to.
|
|
26
|
+
* -> maxRuntime: Maximum time this function is allowed to run, takes integer value in ms. If the max time is exceeded, error is logged.
|
|
27
|
+
* -> returns: Type and variable name in which the return value is stored.
|
|
28
|
+
* @function ${METHOD_NAME}
|
|
29
|
+
* @this ${REFERENCE_OBJECT}
|
|
30
|
+
* @kind ${REFERENCE_OBJECT_BASE_TYPE}
|
|
31
|
+
* @namespace ${NAMESPACE}
|
|
32
|
+
*/
|
|
33
|
+
function ${METHOD_NAME}(){
|
|
34
|
+
var me = this;
|
|
35
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
36
|
+
// //
|
|
37
|
+
// Add your customizing javaScript code below. //
|
|
38
|
+
// //
|
|
39
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
47
|
+
// //
|
|
48
|
+
// Add your customizing javaScript code above. //
|
|
49
|
+
// //
|
|
50
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
4
|
+
// IMPORTANT - DO NOT MODIFY AUTO-GENERATED CODE OR COMMENTS //
|
|
5
|
+
//Parts of this file are auto-generated and modifications to those sections will be //
|
|
6
|
+
//overwritten. You are allowed to modify: //
|
|
7
|
+
// - the tags in the jsDoc as described in the corresponding section //
|
|
8
|
+
// - the function name and its parameters //
|
|
9
|
+
// - the function body between the insertion ranges //
|
|
10
|
+
// "Add your customizing javaScript code below / above" //
|
|
11
|
+
// //
|
|
12
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Use the following jsDoc tags to describe the BL function. Setting these tags will
|
|
16
|
+
* change the runtime behavior in the mobile app. The values specified in the tags determine
|
|
17
|
+
* the name of the contract file. The filename format is “@this . @function .bl.js”.
|
|
18
|
+
* For example, LoVisit.BeforeLoadAsync.bl.js
|
|
19
|
+
* -> function: Name of the businessLogic function.
|
|
20
|
+
* -> this: The LO, BO, or LU object that this function belongs to (and it is part of the filename).
|
|
21
|
+
* -> kind: Type of object this function belongs to. Most common value is "businessobject".
|
|
22
|
+
* -> async: If declared as async then the function should return a promise.
|
|
23
|
+
* -> param: List of parameters the function accepts. Make sure the parameters match the function signature.
|
|
24
|
+
* -> namespace: Use CORE or CUSTOM. If you are a Salesforce client or an implementation partner, always use CUSTOM to enable a seamless release upgrade.
|
|
25
|
+
* -> extends: Base class of the LO, BO, and LU objects that this function belongs to.
|
|
26
|
+
* -> maxRuntime: Maximum time this function is allowed to run, takes integer value in ms. If the max time is exceeded, error is logged.
|
|
27
|
+
* -> returns: Type and variable name in which the return value is stored.
|
|
28
|
+
* @function ${METHOD_NAME}
|
|
29
|
+
* @this ${REFERENCE_OBJECT}
|
|
30
|
+
* @kind ${REFERENCE_OBJECT_BASE_TYPE}
|
|
31
|
+
* @async
|
|
32
|
+
* @namespace ${NAMESPACE}
|
|
33
|
+
* @returns promise
|
|
34
|
+
*/
|
|
35
|
+
function ${METHOD_NAME}(){
|
|
36
|
+
var me = this;
|
|
37
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
38
|
+
// //
|
|
39
|
+
// Add your customizing javaScript code below. //
|
|
40
|
+
// //
|
|
41
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
42
|
+
|
|
43
|
+
var promise=when.resolve();
|
|
44
|
+
|
|
45
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
46
|
+
// //
|
|
47
|
+
// Add your customizing javaScript code above. //
|
|
48
|
+
// //
|
|
49
|
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
50
|
+
|
|
51
|
+
return promise;
|
|
52
|
+
}
|
|
@@ -163,5 +163,124 @@
|
|
|
163
163
|
]
|
|
164
164
|
}
|
|
165
165
|
]
|
|
166
|
+
},
|
|
167
|
+
"businesslogic": {
|
|
168
|
+
"moduleRequired": true,
|
|
169
|
+
"options": [
|
|
170
|
+
{
|
|
171
|
+
"name": "method",
|
|
172
|
+
"questions": [
|
|
173
|
+
{
|
|
174
|
+
"name" : "REFERENCE_OBJECT",
|
|
175
|
+
"message": "Select the reference object to which you want to add the businesslogic method.",
|
|
176
|
+
"type" : "list",
|
|
177
|
+
"choices": {
|
|
178
|
+
"fn" : "getReferenceObjects",
|
|
179
|
+
"args" : ["${MODULE}"]
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"parameters": {
|
|
184
|
+
"NAME": {
|
|
185
|
+
"fn" : "getResourceName",
|
|
186
|
+
"args" : ["${TYPE}", "${NAME}", "${CUSTOM}"]
|
|
187
|
+
},
|
|
188
|
+
"METHOD_NAME": {
|
|
189
|
+
"fn" : "getMethodName",
|
|
190
|
+
"args" : ["${NAME}"]
|
|
191
|
+
},
|
|
192
|
+
"METHOD_FILE_NAME": {
|
|
193
|
+
"fn" : "getMethodFileName",
|
|
194
|
+
"args" : ["${NAME}"]
|
|
195
|
+
},
|
|
196
|
+
"FULL_NAME": "${REFERENCE_OBJECT}.${METHOD_FILE_NAME}",
|
|
197
|
+
"MV": {
|
|
198
|
+
"fn" : "getReferenceObjectMethodFolder",
|
|
199
|
+
"args" : ["${TYPE}", "${REFERENCE_OBJECT}"]
|
|
200
|
+
},
|
|
201
|
+
"REFERENCE_OBJECT_BASE_TYPE": {
|
|
202
|
+
"fn" : "getReferenceObjectBaseType",
|
|
203
|
+
"args" : ["${REFERENCE_OBJECT}"]
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"resources": [
|
|
207
|
+
{
|
|
208
|
+
"type": "folder",
|
|
209
|
+
"target": "${MODULE}/BO/${REFERENCE_OBJECT}/${MV}"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"type": "file",
|
|
213
|
+
"source": "BL_BusinessLogic/${REFERENCE_OBJECT}.${NAME}.bl.js",
|
|
214
|
+
"target": "${MODULE}/BO/${REFERENCE_OBJECT}/${MV}/${FULL_NAME}.bl.js"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"type": "file",
|
|
218
|
+
"action": "update",
|
|
219
|
+
"target": "${MODULE}/BO/${REFERENCE_OBJECT}/${REFERENCE_OBJECT}.${REFERENCE_OBJECT_BASE_TYPE}.xml",
|
|
220
|
+
"tpl" : {
|
|
221
|
+
"xpath" : "//Methods[1]",
|
|
222
|
+
"data" : "<Method name=\"${METHOD_NAME}\" />"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"name": "async method",
|
|
229
|
+
"questions": [
|
|
230
|
+
{
|
|
231
|
+
"name" : "REFERENCE_OBJECT",
|
|
232
|
+
"message": "Select the reference object to which you want to add the businesslogic method.",
|
|
233
|
+
"type" : "list",
|
|
234
|
+
"choices": {
|
|
235
|
+
"fn" : "getReferenceObjects",
|
|
236
|
+
"args" : ["${MODULE}"]
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
"parameters": {
|
|
241
|
+
"NAME": {
|
|
242
|
+
"fn" : "getResourceName",
|
|
243
|
+
"args" : ["${TYPE}", "${NAME}", "${CUSTOM}"]
|
|
244
|
+
},
|
|
245
|
+
"METHOD_NAME": {
|
|
246
|
+
"fn" : "getMethodName",
|
|
247
|
+
"args" : ["${NAME}"]
|
|
248
|
+
},
|
|
249
|
+
"METHOD_FILE_NAME": {
|
|
250
|
+
"fn" : "getMethodFileName",
|
|
251
|
+
"args" : ["${NAME}"]
|
|
252
|
+
},
|
|
253
|
+
"FULL_NAME": "${REFERENCE_OBJECT}.${METHOD_FILE_NAME}",
|
|
254
|
+
"MV": {
|
|
255
|
+
"fn" : "getReferenceObjectMethodFolder",
|
|
256
|
+
"args" : ["${TYPE}", "${REFERENCE_OBJECT}"]
|
|
257
|
+
},
|
|
258
|
+
"REFERENCE_OBJECT_BASE_TYPE": {
|
|
259
|
+
"fn" : "getReferenceObjectBaseType",
|
|
260
|
+
"args" : ["${REFERENCE_OBJECT}"]
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
"resources": [
|
|
264
|
+
{
|
|
265
|
+
"type": "folder",
|
|
266
|
+
"target": "${MODULE}/BO/${REFERENCE_OBJECT}/${MV}"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"type": "file",
|
|
270
|
+
"source": "BL_BusinessLogic/${REFERENCE_OBJECT}.${NAME}Async.bl.js",
|
|
271
|
+
"target": "${MODULE}/BO/${REFERENCE_OBJECT}/${MV}/${FULL_NAME}.bl.js"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"type": "file",
|
|
275
|
+
"action": "update",
|
|
276
|
+
"target": "${MODULE}/BO/${REFERENCE_OBJECT}/${REFERENCE_OBJECT}.${REFERENCE_OBJECT_BASE_TYPE}.xml",
|
|
277
|
+
"tpl" : {
|
|
278
|
+
"xpath" : "//Methods[1]",
|
|
279
|
+
"data" : "<Method name=\"${METHOD_NAME}\" />"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
]
|
|
166
285
|
}
|
|
167
286
|
}
|