diff --git a/bin/main.js b/bin/main.js index f4ff8eb..0f8ee44 100644 --- a/bin/main.js +++ b/bin/main.js @@ -1 +1 @@ -/*! HSO D365 CLI 5.11.4 | (c) HSO Innovation */!function(){"use strict";var e={431:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]","ig"),e.publisher_prefix,t),l.sed("-i",new RegExp("<%= environment %>","ig"),e.environment,t),l.sed("-i",new RegExp("<%= namespace %>","ig"),e.namespace,t)},e.initWebresourcesCrmJson=function(e){var t=l.ls("Webresources/crm.json")[0];l.sed("-i",new RegExp("<%= solution_name_deploy %>","ig"),e.solution_name_deploy,t),l.sed("-i",new RegExp("<%= solution_name_generate %>","ig"),e.solution_name_generate||e.solution_name_deploy,t)},e.initWebresourcesPackageJson=function(e,t){var n=l.ls("Webresources/package.json")[0];l.sed("-i","<%= projectname %>",e.toLowerCase(),n),l.sed("-i",new RegExp("<%= description %>","ig"),t.solution_name_deploy,n)},e.initWebresourcesWebpackConfig=function(e){var t=l.ls("Webresources/webpack.config.ts")[0];l.sed("-i",new RegExp("<%= publisher_prefix %>","ig"),e.publisher_prefix,t),l.sed("-i",new RegExp("<%= namespace %>","ig"),e.namespace,t),l.sed("-i",new RegExp("<%= description %>","ig"),e.namespace,t)},e.inquirer=function(){var e=this;return f.prompt([{type:"input",name:"environment",message:"D365 environment url (eg. https://yourproject.crm4.dynamics.com):",validate:function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){if(!t)throw new Error("You need to provide an environment");if(!new RegExp("https://(www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}").test(t))throw new Error("You need to provide a valid url");return[2,!0]}))}))}},{type:"input",name:"solution_name_deploy",message:"D365 deployment Solution ('Name' column):",validate:function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){if(!t)throw new Error("You need to provide a solution");if(!new RegExp("[a-zA-Z_\\d]*").test(t))throw new Error("You need to provide a valid solution name");return[2,!0]}))}))}},{type:"input",name:"solution_name_generate",message:"D365 generate Solution ('Name' column)\nIf equal to deployment Solution keep blank:",validate:function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){if(t&&!new RegExp("[a-zA-Z_\\d]*").test(t))throw new Error("You need to provide a valid solution name");return[2,!0]}))}))}},{type:"input",name:"solution_name_pcf",message:"D365 PCF Solution ('Name' column)\nIf equal to deployment Solution keep blank:",validate:function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){if(t&&!new RegExp("[a-zA-Z_\\d]*").test(t))throw new Error("You need to provide a valid solution name");return[2,!0]}))}))}},{type:"input",name:"publisher_name",message:"D365 Publisher Name (not Display Name):",validate:function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){if(!t)throw new Error("You need to provide a publisher name");if(!new RegExp("[a-zA-Z_0-9]*").test(t))throw new Error("You need to provide a valid publisher");return[2,!0]}))}))}},{type:"input",name:"publisher_prefix",message:"D365 Publisher Prefix (3 chars a-z):",validate:function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){if(!t)throw new Error("You need to provide a publisher");if(!new RegExp("[a-zA-Z_\\d]*").test(t))throw new Error("You need to provide a valid publisher");return[2,!0]}))}))}},{type:"input",name:"namespace",message:"Customer or Product name:",validate:function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){if(!t)throw new Error("You need to provide a customer or product name");if(!new RegExp("[a-zA-Z_\\d]*").test(t))throw new Error("You need to provide a valid namespace");return[2,!0]}))}))}}])},e}();t.Create=h},342:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return a(t,e),t},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},u=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]")),[4,this.deployDirectory("dist/".concat(t,"_"))];case 1:return r.sent(),this.log("Deploy finished"),[2]}}))}))},t.prototype.deployDirectory=function(e){return s(this,void 0,void 0,(function(){var t=this;return u(this,(function(n){return[2,new Promise((function(n){f.readdir(e,(function(r,o){return s(t,void 0,void 0,(function(){var t,r,i,a,c,s,l,d,p;return u(this,(function(u){switch(u.label){case 0:t=[],r=0,i=o,u.label=1;case 1:return r"),[3,6];case 5:return c=s.sent(),this.log(" failed ".concat(c.message,"
")),[3,6];case 6:return[3,8];case 7:this.log(" unmodified
"),s.label=8;case 8:return[2]}}))}))},t.prototype.insertWebresource=function(e,t){return s(this,void 0,void 0,(function(){var n,r,o,i,a,c,s;return u(this,(function(u){switch(u.label){case 0:n=f.readFileSync(e),r=n.toString("base64"),u.label=1;case 1:return u.trys.push([1,5,,6]),o=this.webresourceSettings.crm.solution_name_deploy,i={content:r,name:t,displayname:t},[4,this.generateDependencyXML(e,i,n)];case 2:return(a=u.sent())&&(i.dependencyxml=a),[4,d.WebresourceService.upsert(i,this.bearer)];case 3:return c=u.sent(),this.log(" inserted..."),[4,d.WebresourceService.addToSolution(c,o,this.bearer)];case 4:return u.sent(),this.log(" and added to solution ".concat(o,"
")),[2,c];case 5:return s=u.sent(),this.log(" failed ".concat(s.message,"
")),[3,6];case 6:return[2]}}))}))},t.prototype.getWebresource=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,d.WebresourceService.retrieveMultipleRecords({select:["name","webresourcetype","content","displayname","solutionid","dependencyxml"],filters:[{conditions:[{attribute:"name",value:e}]}],top:1},this.bearer)];case 1:return[2,t.sent()[0]]}}))}))},t.prototype.generateDependencyXML=function(e,t,n){return s(this,void 0,void 0,(function(){var r,o;return u(this,(function(i){switch(i.label){case 0:return t.name.endsWith(".js")?[4,this.getDependencyXML(t,n)]:[3,2];case 1:return[2,i.sent()];case 2:return t.name.endsWith(".html")?(r=e.replace(/.html/g,".js"),f.existsSync(r)?(o=f.readFileSync(r),[4,this.getDependencyXML(t,o)]):[3,4]):[3,5];case 3:return[2,i.sent()];case 4:console.log("script file: ".concat(r," does not exist")),i.label=5;case 5:return[2]}}))}))},Object.defineProperty(t,"xmlRegex",{get:function(){return/(\s?\n+\s+|\n)/g},enumerable:!1,configurable:!0}),t.prototype.getDependencyXML=function(e,n){return s(this,void 0,void 0,(function(){var r,o,i,a;return u(this,(function(c){switch(c.label){case 0:return[4,this.generateWebresourceXmlDoc(e,n)];case 1:return r=c.sent(),o=t.xmlBuilder.buildObject(r),i=o.replace(t.xmlRegex,""),a=i.indexOf("?>"),[2,i=i.substr(a+2)]}}))}))},Object.defineProperty(t,"defaultDependencyxml",{get:function(){return''},enumerable:!1,configurable:!0}),Object.defineProperty(t,"translationRegex",{get:function(){return/\.translate\(["'](.*)["']\)/gm},enumerable:!1,configurable:!0}),t.prototype.generateWebresourceXmlDoc=function(e,n){return s(this,void 0,void 0,(function(){var r,o,i;return u(this,(function(a){switch(a.label){case 0:return r=y.ls("dist/**/locales/*.resx"),0===(o=r.map((function(e){return e.substr(5)}))).length&&null===e.dependencyxml?[2,null]:[4,b.parseStringPromise(e.dependencyxml||t.defaultDependencyxml)];case 1:return i=a.sent(),t.translationRegex.test(String(n))?(this.addLibraries(i,o),this.cleanLibraries(i,o)):this.cleanLibraries(i),[2,i]}}))}))},t.prototype.addLibraries=function(e,n){var r=e.Dependencies.Dependency[0];r.Library||(r.Library=[]);for(var o=function(e){r.Library.find((function(t){return t.$.name===e}))||(i.log("Adding dependency: ".concat(e)),r.Library.push({$:t.createLibraryItem(e)}))},i=this,a=0,c=n;a=0;o-=1){var i=r.Library[o].$.name;t.localesResxRegex.test(i)&&(n.includes(i)||(this.log("Removing dependency: ".concat(i)),r.Library.splice(o,1)))}},t.createLibraryItem=function(e){return{name:e,displayName:e,languagecode:t.getLanguageCode(e),description:"",libraryUniqueId:t.guid()}},t.getLanguageCode=function(e){var n;return e.endsWith(".resx")&&(n=t.localesResxRegex.exec(e)),n&&n[1]||""},t.guid=function(){return"{xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx}".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},t.xmlBuilder=new b.Builder,t}(p.AdalRouter);t.Deploy=g},883:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PCF=void 0;var c=a(n(27)),s=a(n(357)),u=i(n(147)),l=a(n(81)),f=function(){function e(){}return e.createComponent=function(t){c.default.test("-e","../pcf")?t?c.default.test("-e",t)?console.log(s.default.red("Control already exists")):c.default.which("pac")?e.create(t):console.log(s.default.red("You need to install pac first: https://aka.ms/PowerAppsCLI")):console.log(s.default.red("No control name specified!")):console.log(s.default.red("You are not inside the project 'pcf' folder!"))},e.create=function(t){c.default.exec("mkdir ".concat(t)),c.default.cd(t),e.pacInit(t),e.addComponentFiles(t),e.addReference(t)},e.pacInit=function(e){c.default.exec("pac install latest");var t=JSON.parse(u.readFileSync("../../crm.json","utf8")).crm.publisher_prefix;t&&c.default.exec("pac pcf init --namespace ".concat(t," --name ").concat(e," --template field"))},e.addComponentFiles=function(e){c.default.cp("-f","".concat(__dirname,"/PCF/*"),"."),c.default.cp("-f","".concat(__dirname,"/PCF/.*"),".");var t="./".concat(e,"/").concat(e,".tsx");c.default.cp("-r","".concat(__dirname,"/PCF/Component/PCFComponent.tsx"),t),c.default.sed("-i",new RegExp("PCFComponent","g"),e,t),c.default.cp("-f","".concat(__dirname,"/PCF/Component/index.ts"),"./".concat(e)),c.default.sed("-i",new RegExp("PCFComponent","g"),e,"./".concat(e,"/index.ts")),c.default.cp("-f","".concat(__dirname,"/PCF/Component/FieldComponent.ts"),"./".concat(e)),c.default.exec("npm install --save-dev @fluentui/react eslint-plugin-react eslint-plugin-react-hooks rxjs"),c.default.test("-e","../../.git")&&l.default.execFileSync("git",["add","../".concat(e)])},e.addReference=function(e){var t=process.cwd();c.default.cd(".."),c.default.cd("Solutions"),l.default.execFileSync("pac",["solution","add-reference","--path",t]);var n="msbuild /t:build /restore";c.default.exec(n),n+=" /p:configuration=Release",c.default.exec(n),c.default.cd(".."),c.default.cd(e)},e.build=function(){if(c.default.test("-f","Solutions.cdsproj")){var e="msbuild /t:build";c.default.exec(e),e+=" /p:configuration=Release",c.default.exec(e)}else console.log(s.default.red("You are not inside the PCF/Solutions folder containing the Solutions.cdsproj file!"))},e.initPcfSolution=function(e,t,n){if(!c.default.test("-e","Solutions")){c.default.exec("mkdir Solutions"),c.default.cd("Solutions");var r="pac solution init --publisher-name ".concat(t," --publisher-prefix ").concat(n);c.default.exec(r);var o=e;c.default.sed("-i",new RegExp("Solutions","ig"),"".concat(o,""),"src/Other/Solution.xml")}},e.deploy=function(){if(c.default.test("-f","Solutions.cdsproj"))console.log(s.default.red("Deployment should be done on component level!"));else{var e=JSON.parse(u.readFileSync("../crm.json","utf8"));c.default.exec("pac pcf push --publisher-prefix ".concat(e.crm.publisher_prefix)),console.log(s.default.red("When getting an error about 'No profiles found' you need to set this up by following command:")),console.log(s.default.red("pac auth create --url ".concat(e.crm.url)));console.log("See further information here: ".concat("https://docs.microsoft.com/en-us/powerapps/developer/component-framework/import-custom-controls#connecting-to-your-environment"))}},e}();t.PCF=f},982:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&e.addLocalesFile(),[4,e.processCodeKeys(t)];case 1:return n.sent(),[2,null]}}))}))},e.getCodeKeys=function(){for(var t=new Set,n=0,r=s.ls("src/**/*.ts*");n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]","ig"),e.crm.publisher_prefix,"../crm.json"),l.default.sed("-i",new RegExp("<%= environment %>","ig"),e.crm.url,"../crm.json"),l.default.sed("-i",new RegExp("<%= namespace %>","ig"),e.webresource.namespace,"../crm.json"),l.default.exec("git add ../crm.json");var t=JSON.parse(f.default.readFileSync("./tools/crm.json","utf8"));l.default.cp("-R","".concat(__dirname,"/root/Webresources/crm.json"),"."),l.default.sed("-i",new RegExp("<%= solution_name_deploy %>","ig"),t.crm.solution_name_deploy,"./crm.json"),l.default.sed("-i",new RegExp("<%= solution_name_generate %>","ig"),t.crm.solution_name_generate,"./crm.json"),l.default.exec("git add ./crm.json"),l.default.rm("-rf","./tools"),l.default.exec("git rm ./tools")}},e.updatePackageJson=function(){console.log("Updating package.json...");var e=JSON.parse(f.default.readFileSync("./package.json","utf8")),t=e.name,n=e.description,r=e.version,o=JSON.parse(f.default.readFileSync("../crm.json","utf8"));l.default.cp("-R","".concat(__dirname,"/root/Webresources/package.json"),".");var i=l.default.ls("package.json")[0];l.default.sed("-i",new RegExp("<%= projectname %>","ig"),t,i),l.default.sed("-i",new RegExp("<%= description %>","ig"),n,i),l.default.sed("-i",new RegExp("<%= publisher %>","ig"),o.crm.publisher_prefix,i),l.default.sed("-i",new RegExp("<%= version %>","ig"),r,i),console.log("Removing old npm packages. This may take a while..."),l.default.exec("npm prune"),l.default.exec("npm install")},e.updateWebpackConfig=function(){return a(this,void 0,void 0,(function(){var e,t,n,r,o,i,a,s,u,d,p;return c(this,(function(c){return console.log("Updating webpack.config..."),f.default.existsSync("./webpack.config.ts")&&(t=/entry: {...entry, ...(?{[^{]*)}/gm,n=String(f.default.readFileSync("./webpack.config.ts")),e=t.exec(n)),f.default.existsSync("./webpack.config.js")&&(console.log("webpack.config.js exists"),r=String(f.default.readFileSync("webpack.config.js")),e=/entry: (?{[^{]*})/gm.exec(r),l.default.exec("git rm webpack.config.js")),l.default.cp("-R","".concat(__dirname,"/root/Webresources/webpack.config.ts"),"."),o=JSON.parse(f.default.readFileSync("./package.json","utf8")),i=o.description,a=JSON.parse(f.default.readFileSync("../crm.json","utf8")),s=a.crm,u=s.namespace,d=s.publisher_prefix,p=(p=(p=(p=(p=String(f.default.readFileSync("./webpack.config.ts"))).replace(new RegExp("<%= publisher %>","ig"),d)).replace(new RegExp("<%= namespace %>","ig"),u)).replace(new RegExp("<%= description %>","ig"),i)).replace(new RegExp("entry: {...entry, ...{}","ig"),"entry: {...entry, ...".concat(e.groups.entries)),l.default.ShellString(p).to("./webpack.config.ts"),l.default.exec("git add webpack.config.ts"),[2]}))}))},e}();t.Update=d},152:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]"))];case 1:return a.sent(),e=this,[4,d.NodeApi.getAttributesMetadata(this.entityLogicalName,this.bearer)];case 2:return e.attributesMetadata=a.sent(),[4,this.getFormContextAttributesString()];case 3:return t=a.sent(),n="src/".concat(this.entityName,"/").concat(this.entityName,".formContext.ts"),u.cp("-r","".concat(__dirname,"/Entity/Entity.attributesContext.ts"),"src/".concat(this.entityName)),u.cp("-r","src/".concat(this.entityName,"/Entity.attributesContext.ts"),n),u.rm("-rf","src/".concat(this.entityName,"/Entity.attributesContext.ts")),u.sed("-i",new RegExp("Entity","g"),this.entityName,n),u.test("-e","../.git")&&f.default.execFileSync("git",["add",n]),r=String(l.readFileSync(n)),o="".concat(this.entityName,"FormContext {"),i=r.replace(o,"".concat(o,"\n").concat(t)),u.ShellString(i).to(n),[4,this.log("Generated ".concat(this.entityName,".formContext.ts
"))];case 4:return a.sent(),[2]}}))}))},e.prototype.getFormContextAttributesString=function(){return a(this,void 0,void 0,(function(){var t,n,r,o,i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:t="",n=0,r=this.attributesMetadata,c.label=1;case 1:return n"]:[3,3];case 3:return["Picklist","Status","State"].includes(t)?(r="".concat(this.entityName,"_").concat(n,"Values"),[2,"Xrm.Attributes.OptionSetAttribute<".concat(r,">")]):[3,4];case 4:return["Integer","Double","BigInt","Decimal","Double","Money"].includes(t)?[2,"Xrm.Attributes.NumberAttribute"]:[3,5];case 5:return["Lookup","Customer","Owner"].includes(t)?[2,"Xrm.Attributes.LookupAttribute"]:[3,6];case 6:return[4,this.log(''.concat(this.entityLogicalName," attribute ").concat(t," falls back to Xrm.Attributes.Attribute.
"))];case 7:return o.sent(),[2,"Xrm.Attributes.Attribute"]}}))}))},e.capitalize=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},e}();t.AttributeFormContext=p},911:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]"))];case 1:return a.sent(),e=this,[4,d.NodeApi.getAttributesMetadata(this.entityLogicalName,this.bearer)];case 2:return e.attributesMetadata=a.sent(),[4,this.getTypingsAttributesString()];case 3:return t=a.sent(),n="src/".concat(this.entityName,"/").concat(this.entityName,".d.ts"),u.cp("-r","".concat(__dirname,"/Entity/Entity.d.ts"),"src/".concat(this.entityName)),u.cp("-r","src/".concat(this.entityName,"/Entity.d.ts"),n),u.rm("-rf","src/".concat(this.entityName,"/Entity.d.ts")),u.sed("-i",new RegExp("Entity","g"),this.entityName,n),u.test("-e","../.git")&&f.default.execFileSync("git",["add",n]),r=String(l.readFileSync(n)),o="interface ".concat(this.entityName,"Attributes {"),i=r.replace(o,"".concat(o,"\n").concat(t)),u.ShellString(i).to(n),[4,this.log("Generated ".concat(this.entityName,".formContext.ts
"))];case 4:return a.sent(),[2]}}))}))},e.prototype.getTypingsAttributesString=function(){return a(this,void 0,void 0,(function(){var e,t,n,r,o,i;return c(this,(function(a){switch(a.label){case 0:e="",t=0,n=this.attributesMetadata,a.label=1;case 1:return t"]:[3,3];case 3:return["Picklist","Status","State"].includes(t)?(r="".concat(this.entityName,"_").concat(n,"Values"),[2,"Xrm.Attributes.OptionSetAttribute<".concat(r,">")]):[3,4];case 4:return["Integer","Double","BigInt","Decimal","Double","Money"].includes(t)?[2,"Xrm.Attributes.NumberAttribute"]:[3,5];case 5:return["Lookup","Customer","Owner"].includes(t)?[2,"Xrm.Attributes.LookupAttribute"]:[3,6];case 6:return[4,this.log(''.concat(this.entityLogicalName," attribute ").concat(t," falls back to Xrm.Attributes.Attribute.
"))];case 7:return o.sent(),[2,"Xrm.Attributes.Attribute"]}}))}))},e}();t.AttributeTypings=p},807:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]"))];case 1:return c.sent(),n=this,[4,d.NodeApi.getAttributesMetadata(this.entityLogicalName,this.bearer)];case 2:return n.attributesMetadata=c.sent(),[4,this.getFormContextControlsString(e)];case 3:return r=c.sent(),o="src/".concat(this.entityName,"/").concat(t,"/").concat(t,".formContext.ts"),u.cp("-r","".concat(__dirname,"/Entity/Entity.formContext.ts"),"src/".concat(this.entityName,"/").concat(t)),u.cp("-r","src/".concat(this.entityName,"/").concat(t,"/Entity.formContext.ts"),o),u.rm("-rf","src/".concat(this.entityName,"/").concat(t,"/Entity.formContext.ts")),u.sed("-i",new RegExp("Entity","g"),this.entityName,o),u.sed("-i",new RegExp("FormName","g"),t,o),u.test("-e","../.git")&&f.default.execFileSync("git",["add",o]),i=String(l.readFileSync(o)),a=i.match(new RegExp("".concat(t,"FormContext extends AttributeFormContext {"),"ig"))[0],s=i.replace(a,"".concat(a,"\n").concat(r)),u.ShellString(s).to(o),[4,this.log("Generated ".concat(t,"/").concat(t,".formContext.ts
"))];case 4:return c.sent(),[2]}}))}))},e.prototype.getFormContextControlsString=function(t){return a(this,void 0,void 0,(function(){var n,r,o,i,a;return c(this,(function(c){switch(c.label){case 0:return n="",e.usedControlNames=[],r=JSON.parse(t.formjson),o=n,[4,this.getTabsString(r.Tabs.$values)];case 1:return n=o+c.sent(),i=n,[4,this.getControlsString(r.Header.Controls.$values)];case 2:return n=i+c.sent(),a=n,[4,this.getControlsString(r.Footer.Controls.$values)];case 3:return[2,n=a+c.sent()]}}))}))},e.prototype.getTabsString=function(t){return a(this,void 0,void 0,(function(){var n,r,o,i,a,s,u,l,f;return c(this,(function(c){switch(c.label){case 0:n="",e.usedSectionNames=[],r=0,o=t,c.label=1;case 1:return r'.concat(this.entityLogicalName," control ").concat(n," type '").concat(t,"' falls back to Xrm.Controls.StandardControl."))];case 5:return i.sent(),[2,"Xrm.Controls.StandardControl"]}}))}))},e.capitalize=function(e){return void 0===e&&(e=""),e.charAt(0).toUpperCase()+e.slice(1)},e}();t.ControlFormContext=p},58:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Using entityLogicalName '").concat(this.entityLogicalName,"'
"))];case 2:return t.sent(),[4,new b.Model(this.bearer,this.entityName,(function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){return[2,this.log(t)]}))}))})).generate()];case 3:return t.sent(),[4,y.Enum.generateEnum(this.bearer,this.entityName,this.entityLogicalName,(function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){return[2,this.log(t)]}))}))}))];case 4:return t.sent(),this.options.skipForms?[3,8]:[4,v.AttributeTypings.generate(this.bearer,this.entityName,this.entityLogicalName,(function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){return[2,this.log(t)]}))}))}))];case 5:return t.sent(),[4,m.AttributeFormContext.generateFormContext(this.bearer,this.entityName,this.entityLogicalName,(function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){return[2,this.log(t)]}))}))}))];case 6:return t.sent(),[4,g.Form.generateFormFiles(this.bearer,this.entityName,this.entityLogicalName,(function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){return[2,this.log(t)]}))}))}))];case 7:return t.sent(),[3,10];case 8:return[4,this.log("Skip generate form files")];case 9:t.sent(),t.label=10;case 10:return[4,this.log("Generating files finished")];case 11:return t.sent(),[2]}}))}))},e.prototype.generateEntityFiles=function(){return a(this,void 0,void 0,(function(){var e,t,n,r,o;return c(this,(function(i){switch(i.label){case 0:return e="src/".concat(this.entityName,"/").concat(this.entityName,".service.ts"),l.test("-f",e)?[3,7]:[4,f.prompt([{type:"input",name:"entityLogicalName",message:"Entity LogicalName:"}])];case 1:t=i.sent(),this.entityLogicalName=t.entityLogicalName,i.label=2;case 2:return i.trys.push([2,4,,5]),[4,h.NodeApi.getEntityDefinition(this.entityLogicalName,this.bearer,["PrimaryIdAttribute"])];case 3:return i.sent(),[3,5];case 4:throw n=i.sent(),console.log(u.default.red("Failed: Entity ".concat(this.entityName," has no LogicalName ").concat(this.entityLogicalName))),n;case 5:return l.mkdir("src/".concat(this.entityName)),[4,this.addEntityFiles(this.entityName)];case 6:return i.sent(),[3,9];case 7:return r=String(d.readFileSync(e)),o=r.match(new RegExp("static logicalName = '([a-zA-Z0-9_]*)';")),this.entityLogicalName=o[1],[4,this.log('Entity '.concat(this.entityName," already exist"))];case 8:i.sent(),i.label=9;case 9:return[2]}}))}))},e.prototype.addEntityFiles=function(e){return a(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.addServiceFile(e)];case 1:return t.sent(),[4,this.addBuildFile()];case 2:return t.sent(),[2]}}))}))},e.prototype.addServiceFile=function(e){return a(this,void 0,void 0,(function(){var t;return c(this,(function(n){switch(n.label){case 0:return[4,this.log("Adding ".concat(e,"/").concat(e,".service.ts..."))];case 1:return n.sent(),t="src/".concat(this.entityName,"/").concat(this.entityName,".service.ts"),l.cp("-r","".concat(__dirname,"/Entity/Entity.service.ts"),t),l.sed("-i",new RegExp("EntityLogicalName","g"),this.entityLogicalName,t),l.sed("-i",new RegExp("Entity","g"),e,t),l.test("-e","../.git")&&p.default.execFileSync("git",["add",t]),[4,this.log("Added ".concat(e,"/").concat(e,".service.ts"))];case 2:return n.sent(),[2]}}))}))},e.prototype.addBuildFile=function(){return a(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return[4,this.log("Adding ".concat(this.entityName,"/build.json"))];case 1:return t.sent(),e="src/".concat(this.entityName,"/build.json"),l.cp("-r","".concat(__dirname,"/Entity/build.json"),e),l.test("-e","../.git")&&p.default.execFileSync("git",["add",e]),[4,this.log("Added ".concat(this.entityName,"/build.json"))];case 2:return t.sent(),[2]}}))}))},e}();t.Entity=w},110:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]"))];case 1:return a.sent(),[4,this.getAttributeNamesEnumString()];case 2:return e=a.sent(),[4,this.getNavigationPropertyNamesString()];case 3:return t=a.sent(),[4,this.getSavedQueriesString()];case 4:return n=a.sent(),[4,this.getEnumStrings()];case 5:return r=a.sent(),o="src/".concat(this.entityName,"/").concat(this.entityName,".enum.ts"),u.cp("-r","".concat(__dirname,"/Entity/Entity.enum.ts"),"src/".concat(this.entityName)),u.cp("-r","src/".concat(this.entityName,"/Entity.enum.ts"),o),u.rm("-rf","src/".concat(this.entityName,"/Entity.enum.ts")),u.test("-e","../.git")&&p.default.execFileSync("git",["add",o]),i=String(l.readFileSync(o)),[4,this.log("Generated ".concat(this.entityName,".enum.ts
"))];case 6:return a.sent(),u.ShellString(i+e+t+r+n).to(o),[2]}}))}))},e.prototype.getSavedQueriesString=function(){return a(this,void 0,void 0,(function(){var t,n,r,o,i,a,s;return c(this,(function(c){switch(c.label){case 0:return t="",t+="export const ".concat(this.entityName.charAt(0).toLowerCase()).concat(this.entityName.slice(1),"Views = {\n"),[4,d.SavedQueryService.retrieveMultipleRecords({select:["savedqueryid","name","returnedtypecode"],filters:[{conditions:[{attribute:"returnedtypecode",value:this.entityLogicalName}]}]},this.bearer)];case 1:for(n=c.sent(),r=0,o=n;r0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1] {"),p="const environmentVariableValue = await EnvironmentVariableService.getEnvironmentVariableValue('".concat(s.schemaname,"');"),h=e.getReturnString(s),t+="".concat(d,"\n ").concat(p,"\n ").concat(h,"\n }\n\n");return[2,t]}}))}))},e.getReturnString=function(e){if(1e8===e.type)return"return environmentVariableValue ? environmentVariableValue.value : '".concat(e.defaultvalue,"';");if(100000001===e.type)return"return environmentVariableValue ? parseFloat(environmentVariableValue.value) : ".concat(e.defaultvalue,";");if(100000002===e.type)return"return environmentVariableValue ? environmentVariableValue.value === 'yes' : ".concat("yes"===e.defaultvalue,";");if(100000003===e.type){var t="// eslint-disable-next-line quotes\n ";return t+="return environmentVariableValue ? JSON.parse(environmentVariableValue.value) : ".concat(e.defaultvalue,";")}if(100000004===e.type){t="// Not supported or go ahead with the value\n ";return t+="return environmentVariable ? environmentVariableValue.value as unknown : null"}},e.getEnvironmentType=function(e){return 1e8===e.type?"string":100000001===e.type?"number":100000002===e.type?"boolean":100000003===e.type?"JSON":100000004===e.type?"unknown":void 0},e.prototype.getEnvironmentVariableDefinitions=function(){return a(this,void 0,void 0,(function(){var e,t,n,r,o,i,a,s,l,h;return c(this,(function(c){switch(c.label){case 0:return e=[],t=JSON.parse(u.readFileSync("./crm.json","utf8")),n=t.crm.solution_name_generate,[4,f.SolutionService.getSolution(n,["solutionid"],this.bearer)];case 1:return r=c.sent(),[4,d.SolutionComponentService.retrieveMultipleRecords({select:["objectid"],filters:[{conditions:[{attribute:"_solutionid_value",value:r.solutionid}]},{type:"or",conditions:[{attribute:"componenttype",value:380}]}]},this.bearer)];case 2:o=c.sent(),i=0,a=o,c.label=3;case 3:return i0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]'.concat(this.entityName,"/").concat(o," already exist"))];case 6:l.sent(),l.label=7;case 7:return[4,h.FormTypings.generate(this.bearer,this.entityName,this.entityLogicalName,(function(e){return a(s,void 0,void 0,(function(){return c(this,(function(t){return[2,this.log(e)]}))}))}),r)];case 8:return l.sent(),[4,d.ControlFormContext.generateFormContext(this.bearer,this.entityName,this.entityLogicalName,(function(e){return a(s,void 0,void 0,(function(){return c(this,(function(t){return[2,this.log(e)]}))}))}),r)];case 9:l.sent(),l.label=10;case 10:return t++,[3,2];case 11:return[2]}}))}))},e.prototype.addEntityFiles=function(e){return a(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.addEntityFile(e)];case 1:return t.sent(),[4,this.addEntityFormFile(e)];case 2:return t.sent(),[2]}}))}))},e.prototype.addEntityFile=function(e){return a(this,void 0,void 0,(function(){var t,n,r,o,i,a;return c(this,(function(c){switch(c.label){case 0:return t=e.name.replace(/\W/g,""),[4,this.log("Adding ".concat(this.entityName,"/").concat(t,"/").concat(t,".ts"))];case 1:return c.sent(),n="src/".concat(this.entityName,"/").concat(t,"/").concat(t,".ts"),r=JSON.parse(l.readFileSync("../crm.json","utf8")),o=r.crm,i=o.namespace,a=o.publisher_prefix,u.cp("-r","".concat(__dirname,"/Entity/Entity.ts"),n),u.sed("-i",new RegExp("Entity","g"),t,n),u.sed("-i",new RegExp("<%= publisher %>","ig"),a,n),u.sed("-i",new RegExp("<%= namespace %>","ig"),i,n),u.sed("-i",new RegExp("<%= formname %>","ig"),e.name,n),u.sed("-i",new RegExp("<%= entity %>","ig"),this.entityName,n),u.test("-e","../.git")&&f.default.execFileSync("git",["add",n]),[4,this.log("Added ".concat(this.entityName,"/").concat(t,"/").concat(t,".ts"))];case 2:return c.sent(),[2]}}))}))},e.prototype.addEntityFormFile=function(e){return a(this,void 0,void 0,(function(){var t,n;return c(this,(function(r){switch(r.label){case 0:return t=e.name.replace(/\W/g,""),[4,this.log("Adding ".concat(this.entityName,"/").concat(t,"/").concat(t,".form.ts"))];case 1:return r.sent(),n="src/".concat(this.entityName,"/").concat(t,"/").concat(t,".form.ts"),u.cp("-r","".concat(__dirname,"/Entity/Entity.form.ts"),n),u.sed("-i",new RegExp("Entity","g"),t,n),u.test("-e","../.git")&&f.default.execFileSync("git",["add",n]),[4,this.log("Added ".concat(this.entityName,"/").concat(t,"/").concat(t,".form.ts"))];case 2:return r.sent(),[2]}}))}))},e.prototype.updateBuildFile=function(e){return a(this,void 0,void 0,(function(){var t,n,r,o;return c(this,(function(i){switch(i.label){case 0:return t=e.name.replace(/\W/g,""),[4,this.log("Updating ".concat(this.entityName,"/build.json"))];case 1:return i.sent(),n="src/".concat(this.entityName,"/build.json"),r=String(l.readFileSync(n)),(o=JSON.parse(r)).forms.find((function(e){return e.name===t}))||(o.forms.push({name:t,build:!0}),u.ShellString(JSON.stringify(o,null,2)).to(n),u.test("-e","../.git")&&f.default.execFileSync("git",["add",n])),[4,this.log("Updated ".concat(this.entityName,"/build.json"))];case 2:return i.sent(),[2]}}))}))},e.prototype.getSystemForms=function(){return a(this,void 0,void 0,(function(){var e,t,n,r;return c(this,(function(o){switch(o.label){case 0:return[4,p.SystemFormService.getSystemForms(this.entityLogicalName,["objecttypecode","name","formjson"],this.bearer)];case 1:e=o.sent(),t=0,n=e,o.label=2;case 2:return tForm \''.concat(r.name,"' found"))]):[3,5];case 3:o.sent(),o.label=4;case 4:return t++,[3,2];case 5:return[2,e]}}))}))},e}();t.Form=b},470:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]"))];case 1:return c.sent(),t=this,[4,l.NodeApi.getAttributesMetadata(this.entityLogicalName,this.bearer)];case 2:return t.attributesMetadata=c.sent(),n="declare namespace ".concat(this.entityName," {\n"),r=e.name.replace(/\W/g,""),n+=" type ".concat(r," = Omit<").concat(this.entityName,".AttributesFormContext, 'getControl'> & ").concat(this.entityName).concat(r,"Controls;\n\n"),n+=" interface ".concat(this.entityName).concat(r,"Controls {\n"),o=n,[4,this.getFormTypingsControlsString(e)];case 3:return n=o+c.sent(),n+=" }\n}",i="src/".concat(this.entityName,"/").concat(this.entityName,".d.ts"),a=String(u.readFileSync(i)),s.ShellString("".concat(a,"\n").concat(n)).to(i),[4,this.log("Updated ".concat(this.entityName,".d.ts
"))];case 4:return c.sent(),[2]}}))}))},e.prototype.getFormTypingsControlsString=function(t){return a(this,void 0,void 0,(function(){var n,r,o,i,a;return c(this,(function(c){switch(c.label){case 0:return n="",e.usedControlNames=[],r=JSON.parse(t.formjson),o=n,[4,this.getTabsString(r.Tabs.$values)];case 1:return n=o+c.sent(),i=n,[4,this.getControlsString(r.Header.Controls.$values)];case 2:return n=i+c.sent(),a=n,[4,this.getControlsString(r.Footer.Controls.$values)];case 3:return[2,n=a+c.sent()]}}))}))},e.prototype.getTabsString=function(e){return a(this,void 0,void 0,(function(){var t,n,r,o,i;return c(this,(function(a){switch(a.label){case 0:t="",n=0,r=e,a.label=1;case 1:return n'.concat(this.entityLogicalName," control ").concat(n," type '").concat(t,"' falls back to Xrm.Controls.StandardControl."))];case 5:return i.sent(),[2,"Xrm.Controls.StandardControl"]}}))}))},e}();t.FormTypings=f},433:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Generator=void 0;var c=a(n(357)),s=i(n(27)),u=n(597),l=n(668),f=n(482),d=n(760),p=n(805),h=n(660),b=function(){function e(){}return e.generate=function(e,t,n){if(s.test("-e","src"))if(e)if(["entity","webresource","model","licensevalidator","environmentvariable","globaloptionsets"].includes(e.toLowerCase())){if("entity"===e.toLowerCase())return d.EntityRouter.generateEntity(t,n);if("webresource"===e.toLowerCase())return u.Webresource.generateWebresource(t);if("model"===e.toLocaleLowerCase())return l.ModelRouter.generateModel(t);if("licensevalidator"===e.toLowerCase())return f.LicenseValidator.generateLicenseValidator(t);if("environmentvariable"===e.toLowerCase())return h.EnvironmentVariableRouter.generateEnvironmentVariable();if("globaloptionsets"===e.toLowerCase())return p.GlobalOptionSetRouter.generateGlobalOptionSets()}else console.log(c.default.red("Schematic ".concat(e," not supported!")));else console.log(c.default.red("No schematic specified!"));else console.log(c.default.red("You are not inside the project Webresources folder!"))},e.showGenerateHelp=function(){console.log("Arguments:"),console.log(" ".concat(c.default.blue("schematic"))),console.log(" The schematic or collection:schematic to generate."),console.log(" Example: Entity, Webresource or LicenseValidator.")},e}();t.Generator=b},192:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]","ig"),e,"src/License/".concat(i)),l.sed("-i",new RegExp("<%= publisher %>","ig"),o,"src/License/".concat(i)),l.sed("-i",new RegExp("<%= namespace %>","ig"),r,"src/License/".concat(i))})),i=l.ls("webpack.config.ts")[0],l.sed("-i","entry: {",'entry: {\n LicenseValidator: [\n path.resolve(__dirname, "src/License/Validator.ts")\n ],',i),l.exec("git add webpack.config.ts"),console.log("Adding D365 License Validator done"),[2]}))}))},e}();t.LicenseValidator=d},160:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]Entity '.concat(this.entityName," already exist"))];case 8:return a.sent(),[4,this.addModelFile()];case 9:a.sent(),a.label=10;case 10:return[4,this.log("Generating files finished")];case 11:return a.sent(),[2]}}))}))},e.prototype.addModelFile=function(){return a(this,void 0,void 0,(function(){var e,t,n,r,o,i,a,s,d,p,b,y;return c(this,(function(c){switch(c.label){case 0:return[4,this.log("Generating ".concat(this.entityName,".model.ts
"))];case 1:return c.sent(),e="src/".concat(this.entityName,"/").concat(this.entityName,".model.ts"),u.cp("-r","".concat(__dirname,"/Entity/Entity.model.ts"),"src/".concat(this.entityName)),u.cp("-r","src/".concat(this.entityName,"/Entity.model.ts"),e),u.rm("-rf","src/".concat(this.entityName,"/Entity.model.ts")),u.sed("-i",new RegExp("Entity","g"),this.entityName,e),u.test("-e","../.git")&&h.default.execFileSync("git",["add",e]),t=String(l.readFileSync(e)),n=this,[4,f.NodeApi.getAttributesMetadata(this.entityLogicalName,this.bearer)];case 2:return n.attributesMetadata=c.sent(),[4,this.getAttributeInterfaceTypes()];case 3:return r=c.sent(),[4,this.getRelationshipInterfaceTypes()];case 4:return o=c.sent(),[4,this.getImportStrings(o)];case 5:return i=c.sent(),[4,this.getTypeStrings()];case 6:return a=c.sent(),[4,this.getAttributesString(r,o)];case 7:return s=c.sent(),d=s,[4,this.getRelationshipsString(o,r)];case 8:return s=d+c.sent(),p=s,[4,this.getCombinedAttributeRelationshipString(r,o)];case 9:return s=p+c.sent(),b="".concat(this.entityName,"Model extends Model {"),t=t.replace(b,"".concat(b).concat(s)),y="interface",t=t.replace(y,"".concat(i).concat(a).concat(y)),u.ShellString(t).to(e),[4,this.log("Generated ".concat(this.entityName,".model.ts
"))];case 10:return c.sent(),[2]}}))}))},e.prototype.getImportStrings=function(t){return a(this,void 0,void 0,(function(){var n,r,o,i,a,s,l;return c(this,(function(c){switch(c.label){case 0:n="",r=0,o=Object.keys(t),c.label=1;case 1:return rNavigationProperty \''.concat(i,"' generated
\n Referenced model '").concat(s,"Model' not found.
\n Add referenced entity '").concat(s,'\' by following cli command:
\n hso-d365 generate Entity ').concat(s,'
\n And regenerate \'').concat(this.entityName,'\' by following cli command:
\n hso-d365 generate Entity ').concat(this.entityName,"
\n "))];case 3:c.sent(),c.label=4;case 4:return r++,[3,1];case 5:return[2,n]}}))}))},e.prototype.getCombinedAttributeRelationshipString=function(t,n){return a(this,void 0,void 0,(function(){var r,o,i,a,s,l,f,d,p,h;return c(this,(function(c){switch(c.label){case 0:r="",o=Object.keys(t),i=0,a=Object.keys(n),c.label=1;case 1:return i"))];case 4:c.sent(),c.label=5;case 5:return t++,[3,1];case 6:return[2,e]}}))}))},e.prototype.getInterfaceType=function(e){return a(this,void 0,void 0,(function(){var t,n,r;return c(this,(function(o){switch(o.label){case 0:return t=e.AttributeType,n=e.SchemaName,r=e.AttributeTypeName,["String","Memo","DateTime","Lookup","Customer","Owner","Uniqueidentifier"].includes(t)?[2,"string"]:[3,1];case 1:return["Boolean"].includes(t)?[2,"boolean"]:[3,2];case 2:return["Picklist"].includes(t)?[2,"".concat(this.entityName,"_").concat(n,"Values")]:[3,3];case 3:return["Integer","Double","BigInt","Decimal","Double","Money"].includes(t)?[2,"number"]:[3,4];case 4:return["Status"].includes(t)?[4,f.NodeApi.getStatusOptionSet(this.entityLogicalName,this.bearer)]:[3,6];case 5:return[2,o.sent().Options.map((function(e){return e.Value})).join(" | ")];case 6:return["State"].includes(t)?[4,f.NodeApi.getStateOptionSet(this.entityLogicalName,this.bearer)]:[3,8];case 7:return[2,o.sent().Options.map((function(e){return e.Value})).join(" | ")];case 8:if("MultiSelectPicklistType"===r.Value)return[2,"number[]"];o.label=9;case 9:return[2]}}))}))},e.prototype.getTypeStrings=function(){return a(this,void 0,void 0,(function(){var e,t,n,r,o,i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:e="",t=0,n=this.attributesMetadata,c.label=1;case 1:return t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?(console.log("hso-d365 generate Entity ".concat(i)),[4,new f.Entity(this.bearer,i,(function(e){return a(p,void 0,void 0,(function(){return c(this,(function(t){return[2,this.log(e)]}))}))}),{}).generate()]):[3,3]):[3,4];case 2:h.sent(),h.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},e.prototype.regenerateGlobalOptionSets=function(){return a(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){switch(t.label){case 0:return console.log("hso-d365 generate GlobalOptionSets"),[4,new d.GlobalOptionSet(this.bearer,(function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){return[2,this.log(t)]}))}))})).generate()];case 1:return t.sent(),[2]}}))}))},e.prototype.regenerateEnvironmentVariable=function(){return a(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){switch(t.label){case 0:return console.log("hso-d365 generate EnvironmentVariable"),[4,new p.EnvironmentVariable(this.bearer,(function(t){return a(e,void 0,void 0,(function(){return c(this,(function(e){return[2,this.log(t)]}))}))})).generate()];case 1:return t.sent(),[2]}}))}))},e}();t.Regenerator=h},597:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]","ig"),a,"src/".concat(e,"/").concat(o)),l.sed("-i",new RegExp("<%= namespace %>","ig"),i,"src/".concat(e,"/").concat(o));var c="src/".concat(e,"/").concat(o);p.default.execFileSync("git",["add",c])})),[2]}))}))},e.addBuildFile=function(e,t){return a(this,void 0,void 0,(function(){var n,r,o;return c(this,(function(i){return console.log("Adding ".concat(e,"/build.json")),n="src/".concat(e,"/build.json"),l.cp("-r","".concat(__dirname,"/Entity/build.json"),n),r=String(d.readFileSync(n)),(o=JSON.parse(r)).webresources.find((function(t){return t.name===e}))||(o.webresources.push({name:e,build:!0,template:t.template}),l.ShellString(JSON.stringify(o,null,2)).to(n)),p.default.execFileSync("git",["add",n]),console.log("Added ".concat(e,"/build.json")),[2]}))}))},e}();t.Webresource=h},175:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1] [options]"),c.default.command("new ").alias("n").description("Creates a new workspace and an initial Webresource and PCF setup or creates a new PCF component").action((function(e){a.default.test("-e","../pcf")?y.PCF.createComponent(e):s.Create.createProject(e)})).on("--help",(function(){s.Create.showCreateHelp()})),c.default.command("regenerate").alias("rg").description("Regenerates files").action((function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,b.RegeneratorRouter.regenerate()];case 1:return e.sent(),[2]}}))}))})).on("--help",(function(){console.log("Regenerates files")})),c.default.command("generate [name]").alias("g").option("-s, --skipForms","Skip generating form files").description("Generates and/or modifies files bases on a schematic.").action((function(e,t,n){l.Generator.generate(e,t,n)})).on("--help",(function(){l.Generator.showGenerateHelp()})),c.default.command("extractTranslations").alias("extract").description("Extracts translation to resx files").action((function(){d.Resx.extract()})).on("--help",(function(){console.log("In translation folder a folder 'locales' will be generated having translation files."),console.log("It will generate one locales.resx file."),console.log("You have to add for each required language a copy yourself like locales.1033.resx."),console.log("Once done, the tooling will keep up-to-date for you.")})),c.default.command("lint").alias("l").description("Runs linting tools on project code").action((function(){a.default.exec("npm run lint")})).on("--help",(function(){console.log("Runs linting tools on project code using the configuration as specified in your projects '.eslintrc.json' file")})),c.default.command("build").alias("b").description("Compiles project into an output directory named dist").action((function(){a.default.test("-f","Solutions.cdsproj")?y.PCF.build():a.default.exec("npm run build:prod")})).on("--help",(function(){console.log("The command can be used to build the project to be distributed to the D365 environment using the 'deploy' command")})),c.default.command("deploy").option("-f, --force","Force unmodified files as well").description("Invokes the deploy builder").action((function(e){var t=e.force;a.default.test("-f","Solutions.cdsproj")||a.default.test("-f","pcfconfig.json")?y.PCF.deploy():f.Deploy.deployProject(t)})).on("--help",(function(){console.log("Distributes the project to the D365 environment. You need to run the 'build' command first")})),c.default.command("update").alias("u").description("Updates existing workspace and Webresource setup").action((function(){u.Update.updateProject()})).on("--help",(function(){u.Update.showUpdateHelp()})),c.default.command("setFormCustomizable ").alias("f").description("Sets the Solution forms iscustomizable/canbedeleted true/false").action((function(e){new p.SetFormCustomizable("true"===e)})).on("--help",(function(){console.log("Sets the Solution forms iscustomizable/canbedeleted true/false")})),c.default.command("showFiddlerRule").alias("fiddler").description("Show the Fiddler AutoResponder Rule Editor lines").action((function(){return r(void 0,void 0,void 0,(function(){var e,t,n,r,i,c;return o(this,(function(o){return e=process.cwd(),t=JSON.parse(m.default.readFileSync("../crm.json","utf8")),a.default.test("-e","Solutions")?(n="REGEX:(?insx).+\\/cc_".concat(t.crm.publisher_prefix,".(?'foldername'[^?]*)\\/(?'fname'[^?]*.js)"),r="".concat(e,"\\${foldername}\\out\\controls\\${foldername}\\${fname}"),console.log("Please add to first Rule Editor line (including REGEX:): \n".concat(n)),console.log("Please add to second Rule Editor line: \n".concat(r))):(i="REGEX:(?insx).+\\/".concat(t.crm.publisher_prefix,"_\\/").concat(t.crm.namespace,"\\/(?'foldername'[^?]*)\\/(?'fname'[^?]*.js)"),c="".concat(e,"\\dist\\").concat(t.crm.publisher_prefix,"_\\").concat(t.crm.namespace,"\\${foldername}\\${fname}"),console.log("Please add to first Rule Editor line (including REGEX:): \n".concat(i)),console.log("Please add to second Rule Editor line: \n".concat(c))),[2]}))}))})),c.default.arguments("").action((function(){c.default.outputHelp(),console.log(""),console.log("echo Unknown command!")})),c.default.parse(process.argv)},471:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?"?".concat(s.join("&")):""},e.generateSelect=function(e){return void 0===e&&(e=[]),e.length>0?"$select=".concat(e.join(",")):null},e.generateFilter=function(t){void 0===t&&(t=[]);var n=[];if(t.length>0)for(var r=0,o=t;r0?"$filter=".concat(n.join(" and ")):null},e.parseFilter=function(e){for(var t=e.type,n=void 0===t?"and":t,r=[],o=0,i=e.conditions;o0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]{".concat(e.webresourceid,"}")},[2,i.NodeApi.executeAction("PublishXml",t,n)]}))}))},e.addToSolution=function(e,t,n){return r(this,void 0,void 0,(function(){return o(this,(function(r){return[2,i.NodeApi.executeAction("AddSolutionComponent",n,{ComponentId:e.webresourceid,ComponentType:61,SolutionUniqueName:t,AddRequiredComponents:!1,IncludedComponentSettingsValues:null})]}))}))},e.getWebresourcetype=function(t,n){return r(this,void 0,void 0,(function(){var r,a,c,s,u,l,f,d;return o(this,(function(o){switch(o.label){case 0:return[4,i.NodeApi.getPicklistOptionSet(e.logicalName,"webresourcetype",n)];case 1:for(r=o.sent(),s=0,u=r.Options;s0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]\n Login\n \n \n