Built motion from commit (unavailable).|2.5.7
[motion2.git] / server / api / intDynamics365Account / intDynamics365Account.controller.js
index cefb6ce..0694f54 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f6a=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','clientSecret','slice','format','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','clientId','password','access_token','GET','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','substring','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','@odata.type','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(','OptionSet','UserLocalizedLabel','Label','Value','DisplayName','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x4431ea,_0x165fd8){var _0x55e1c2=function(_0x578abb){while(--_0x578abb){_0x4431ea['push'](_0x4431ea['shift']());}};_0x55e1c2(++_0x165fd8);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x589539,_0x1a07ef){_0x589539=_0x589539-0x0;var _0x3070f9=_0x5f6a[_0x589539];return _0x3070f9;};'use strict';var pdf=require(_0xa5f6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa5f6('0x1'));var jsonpatch=require(_0xa5f6('0x2'));var rp=require(_0xa5f6('0x3'));var moment=require(_0xa5f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa5f6('0x5'));var util=require(_0xa5f6('0x6'));var path=require(_0xa5f6('0x7'));var sox=require(_0xa5f6('0x8'));var csv=require(_0xa5f6('0x9'));var ejs=require(_0xa5f6('0xa'));var fs=require('fs');var _=require(_0xa5f6('0xb'));var squel=require(_0xa5f6('0xc'));var crypto=require(_0xa5f6('0xd'));var jsforce=require(_0xa5f6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa5f6('0xf'));var Redis=require(_0xa5f6('0x10'));var authService=require(_0xa5f6('0x11'));var qs=require(_0xa5f6('0x12'));var as=require(_0xa5f6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5f6('0x14'))(_0xa5f6('0x15'));var utils=require('../../config/utils');var config=require(_0xa5f6('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa5f6('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xa5f6('0x18')][_0xa5f6('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5286b7,_0x42480a,_0x35eade){if(_0x35eade){var _0x2919fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2919fd[_0xa5f6('0x1a')](_0x42480a)){return _0x5286b7;}else{throw new db['Sequelize'][(_0xa5f6('0x1b'))](_0xa5f6('0x1c'));}}else{return _0x5286b7;}}function respondWithRpcPromise(_0x17f7f7,_0x5dc17b,_0x3b4780,_0x3b2b23){return new BPromise(function(_0x1c53a1,_0xdda598){var _0x407845=_0x3b2b23||client;return _0x407845['request'](_0x17f7f7,_0x3b4780)[_0xa5f6('0x1d')](function(_0x39f98a){logger['info'](_0xa5f6('0x1e'),_0x5dc17b,_0xa5f6('0x1f'));logger[_0xa5f6('0x20')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x5dc17b,'request\x20sent',JSON['stringify'](_0x39f98a));if(_0x39f98a[_0xa5f6('0x21')]){if(_0x39f98a['error'][_0xa5f6('0x22')]===0x1f4){logger[_0xa5f6('0x21')](_0xa5f6('0x1e'),_0x5dc17b,_0x39f98a['error'][_0xa5f6('0x23')]);return _0xdda598(_0x39f98a['error'][_0xa5f6('0x23')]);}logger[_0xa5f6('0x21')](_0xa5f6('0x1e'),_0x5dc17b,_0x39f98a[_0xa5f6('0x21')][_0xa5f6('0x23')]);return _0x1c53a1(_0x39f98a['error']['message']);}else{logger[_0xa5f6('0x24')]('Dynamics365Account,\x20%s,\x20%s',_0x5dc17b,_0xa5f6('0x1f'));_0x1c53a1(_0x39f98a['result'][_0xa5f6('0x23')]);}})[_0xa5f6('0x25')](function(_0x4330c4){logger[_0xa5f6('0x21')](_0xa5f6('0x1e'),_0x5dc17b,_0x4330c4);_0xdda598(_0x4330c4);});});}function respondWithStatusCode(_0x220992,_0x7613c4){_0x7613c4=_0x7613c4||0xcc;return function(_0x1bf562){if(_0x1bf562){return _0x220992[_0xa5f6('0x26')](_0x7613c4);}return _0x220992[_0xa5f6('0x27')](_0x7613c4)[_0xa5f6('0x28')]();};}function respondWithResult(_0x4f1887,_0x4bab0a){_0x4bab0a=_0x4bab0a||0xc8;return function(_0x29c101){if(_0x29c101){return _0x4f1887[_0xa5f6('0x27')](_0x4bab0a)[_0xa5f6('0x29')](_0x29c101);}};}function respondWithFilteredResult(_0x12e192,_0x19dc39){return function(_0x8cab41){if(_0x8cab41){var _0x5ac06e=_0x8cab41[_0xa5f6('0x2a')],_0x273192=_0x19dc39[_0xa5f6('0x2b')],_0x43fe1d=_0x19dc39[_0xa5f6('0x2b')]+_0x19dc39[_0xa5f6('0x2c')],_0x3417a8;if(_0x43fe1d>=_0x5ac06e){_0x43fe1d=_0x5ac06e;_0x3417a8=0xc8;}else{_0x3417a8=0xce;}_0x12e192[_0xa5f6('0x27')](_0x3417a8);return _0x12e192['set'](_0xa5f6('0x2d'),_0x273192+'-'+_0x43fe1d+'/'+_0x5ac06e)[_0xa5f6('0x29')](_0x8cab41);}return null;};}function patchUpdates(_0x459887){return function(_0x3f2ef0){try{jsonpatch[_0xa5f6('0x2e')](_0x3f2ef0,_0x459887,!![]);}catch(_0x4bc914){return BPromise[_0xa5f6('0x2f')](_0x4bc914);}return _0x3f2ef0[_0xa5f6('0x30')]();};}function saveUpdates(_0x2e285b,_0x507b3b){return function(_0x3fcefb){if(_0x3fcefb){return _0x3fcefb[_0xa5f6('0x31')](_0x2e285b)[_0xa5f6('0x1d')](function(_0xeb02b1){return _0xeb02b1;});}return null;};}function removeEntity(_0x258085,_0x55f0b0){return function(_0x22bdd7){if(_0x22bdd7){return _0x22bdd7[_0xa5f6('0x32')]()[_0xa5f6('0x1d')](function(){_0x258085[_0xa5f6('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1499ab,_0x9b2ff1){return function(_0x16d38d){if(!_0x16d38d){_0x1499ab[_0xa5f6('0x26')](0x194);}return _0x16d38d;};}function handleError(_0x5495bd,_0x363fad){_0x363fad=_0x363fad||0x1f4;return function(_0x42bba2){logger[_0xa5f6('0x21')](_0x42bba2[_0xa5f6('0x33')]);if(_0x42bba2[_0xa5f6('0x34')]){delete _0x42bba2[_0xa5f6('0x34')];}_0x5495bd['status'](_0x363fad)[_0xa5f6('0x35')](_0x42bba2);};}exports['index']=function(_0x2146f1,_0x5c4721){var _0x5dcd01={},_0x28c430={},_0x5c8521={'count':0x0,'rows':[]};var _0x115a73=_[_0xa5f6('0x36')](db['Dynamics365Account'][_0xa5f6('0x37')],function(_0x51b4bb){return{'name':_0x51b4bb['fieldName'],'type':_0x51b4bb['type'][_0xa5f6('0x38')]};});_0x28c430[_0xa5f6('0x39')]=_[_0xa5f6('0x36')](_0x115a73,_0xa5f6('0x34'));_0x28c430[_0xa5f6('0x3a')]=_[_0xa5f6('0x3b')](_0x2146f1[_0xa5f6('0x3a')]);_0x28c430[_0xa5f6('0x3c')]=_[_0xa5f6('0x3d')](_0x28c430[_0xa5f6('0x39')],_0x28c430[_0xa5f6('0x3a')]);_0x5dcd01[_0xa5f6('0x3e')]=_[_0xa5f6('0x3d')](_0x28c430[_0xa5f6('0x39')],qs['fields'](_0x2146f1[_0xa5f6('0x3a')][_0xa5f6('0x3f')]));_0x5dcd01[_0xa5f6('0x3e')]=_0x5dcd01[_0xa5f6('0x3e')][_0xa5f6('0x40')]?_0x5dcd01[_0xa5f6('0x3e')]:_0x28c430[_0xa5f6('0x39')];if(!_0x2146f1[_0xa5f6('0x3a')][_0xa5f6('0x41')]('nolimit')){_0x5dcd01['limit']=qs['limit'](_0x2146f1[_0xa5f6('0x3a')][_0xa5f6('0x2c')]);_0x5dcd01[_0xa5f6('0x2b')]=qs[_0xa5f6('0x2b')](_0x2146f1[_0xa5f6('0x3a')][_0xa5f6('0x2b')]);}_0x5dcd01['order']=qs[_0xa5f6('0x42')](_0x2146f1[_0xa5f6('0x3a')]['sort']);_0x5dcd01[_0xa5f6('0x43')]=qs[_0xa5f6('0x3c')](_[_0xa5f6('0x44')](_0x2146f1[_0xa5f6('0x3a')],_0x28c430[_0xa5f6('0x3c')]));if(_0x2146f1[_0xa5f6('0x3a')][_0xa5f6('0x45')]){_0x5dcd01[_0xa5f6('0x43')]=_[_0xa5f6('0x46')](_0x5dcd01[_0xa5f6('0x43')],{'$or':_['map'](_0x115a73,function(_0x47e440){if(_0x47e440[_0xa5f6('0x47')]!==_0xa5f6('0x48')){var _0x3c51b9={};_0x3c51b9[_0x47e440['name']]={'$like':'%'+_0x2146f1[_0xa5f6('0x3a')][_0xa5f6('0x45')]+'%'};return _0x3c51b9;}})});}_0x5dcd01=_[_0xa5f6('0x46')]({},_0x5dcd01,_0x2146f1[_0xa5f6('0x49')]);var _0x5e1c96={'where':_0x5dcd01[_0xa5f6('0x43')]};return db[_0xa5f6('0x4a')][_0xa5f6('0x2a')](_0x5e1c96)[_0xa5f6('0x1d')](function(_0x46231a){_0x5c8521[_0xa5f6('0x2a')]=_0x46231a;if(_0x2146f1[_0xa5f6('0x3a')][_0xa5f6('0x4b')]){_0x5dcd01[_0xa5f6('0x4c')]=[{'all':!![]}];}return db[_0xa5f6('0x4a')][_0xa5f6('0x4d')](_0x5dcd01);})[_0xa5f6('0x1d')](function(_0x566c4b){_0x5c8521[_0xa5f6('0x4e')]=_0x566c4b;return _0x5c8521;})[_0xa5f6('0x1d')](respondWithFilteredResult(_0x5c4721,_0x5dcd01))[_0xa5f6('0x25')](handleError(_0x5c4721,null));};exports[_0xa5f6('0x4f')]=function(_0x586893,_0x19d3b1){var _0x44dc92={'raw':![],'where':{'id':_0x586893[_0xa5f6('0x50')]['id']}},_0x3de087={};_0x3de087[_0xa5f6('0x39')]=_[_0xa5f6('0x3b')](db[_0xa5f6('0x4a')][_0xa5f6('0x37')]);_0x3de087[_0xa5f6('0x3a')]=_['keys'](_0x586893[_0xa5f6('0x3a')]);_0x3de087[_0xa5f6('0x3c')]=_[_0xa5f6('0x3d')](_0x3de087[_0xa5f6('0x39')],_0x3de087[_0xa5f6('0x3a')]);_0x44dc92[_0xa5f6('0x3e')]=_[_0xa5f6('0x3d')](_0x3de087['model'],qs[_0xa5f6('0x3f')](_0x586893[_0xa5f6('0x3a')]['fields']));_0x44dc92[_0xa5f6('0x3e')]=_0x44dc92[_0xa5f6('0x3e')][_0xa5f6('0x40')]?_0x44dc92['attributes']:_0x3de087[_0xa5f6('0x39')];if(_0x586893[_0xa5f6('0x3a')][_0xa5f6('0x4b')]){_0x44dc92['include']=[{'all':!![]}];}_0x44dc92=_[_0xa5f6('0x46')]({},_0x44dc92,_0x586893['options']);return db[_0xa5f6('0x4a')][_0xa5f6('0x51')](_0x44dc92)['then'](handleEntityNotFound(_0x19d3b1,null))['then'](respondWithResult(_0x19d3b1,null))[_0xa5f6('0x25')](handleError(_0x19d3b1,null));};exports[_0xa5f6('0x52')]=function(_0x162939,_0x5dce6f){return db[_0xa5f6('0x4a')]['create'](_0x162939['body'],{})[_0xa5f6('0x1d')](respondWithResult(_0x5dce6f,0xc9))[_0xa5f6('0x25')](handleError(_0x5dce6f,null));};exports[_0xa5f6('0x31')]=function(_0x74d0b7,_0x45f47e){if(_0x74d0b7['body']['id']){delete _0x74d0b7[_0xa5f6('0x53')]['id'];}return db['Dynamics365Account'][_0xa5f6('0x51')]({'where':{'id':_0x74d0b7[_0xa5f6('0x50')]['id']}})['then'](handleEntityNotFound(_0x45f47e,null))[_0xa5f6('0x1d')](saveUpdates(_0x74d0b7[_0xa5f6('0x53')],null))[_0xa5f6('0x1d')](respondWithResult(_0x45f47e,null))[_0xa5f6('0x25')](handleError(_0x45f47e,null));};exports[_0xa5f6('0x32')]=function(_0x1ea9f2,_0x45f6de){return db[_0xa5f6('0x4a')][_0xa5f6('0x51')]({'where':{'id':_0x1ea9f2[_0xa5f6('0x50')]['id']}})[_0xa5f6('0x1d')](handleEntityNotFound(_0x45f6de,null))['then'](removeEntity(_0x45f6de,null))['catch'](handleError(_0x45f6de,null));};exports[_0xa5f6('0x54')]=function(_0x5c33fb,_0x366639,_0xfed1ef){var _0x320d57={};var _0x960573={};var _0x38cabd;var _0xef3cb3;return db['Dynamics365Account'][_0xa5f6('0x55')]({'where':{'id':_0x5c33fb['params']['id']}})[_0xa5f6('0x1d')](handleEntityNotFound(_0x366639,null))[_0xa5f6('0x1d')](function(_0x3ff4f2){if(_0x3ff4f2){_0x38cabd=_0x3ff4f2;_0x960573[_0xa5f6('0x39')]=_['keys'](db[_0xa5f6('0x56')][_0xa5f6('0x37')]);_0x960573['query']=_[_0xa5f6('0x3b')](_0x5c33fb[_0xa5f6('0x3a')]);_0x960573[_0xa5f6('0x3c')]=_[_0xa5f6('0x3d')](_0x960573[_0xa5f6('0x39')],_0x960573[_0xa5f6('0x3a')]);_0x320d57['attributes']=_[_0xa5f6('0x3d')](_0x960573['model'],qs[_0xa5f6('0x3f')](_0x5c33fb[_0xa5f6('0x3a')][_0xa5f6('0x3f')]));_0x320d57['attributes']=_0x320d57[_0xa5f6('0x3e')][_0xa5f6('0x40')]?_0x320d57[_0xa5f6('0x3e')]:_0x960573['model'];_0x320d57[_0xa5f6('0x57')]=qs[_0xa5f6('0x42')](_0x5c33fb[_0xa5f6('0x3a')][_0xa5f6('0x42')]);_0x320d57[_0xa5f6('0x43')]=qs[_0xa5f6('0x3c')](_[_0xa5f6('0x44')](_0x5c33fb['query'],_0x960573[_0xa5f6('0x3c')]));if(_0x5c33fb[_0xa5f6('0x3a')][_0xa5f6('0x45')]){_0x320d57['where']=_[_0xa5f6('0x46')](_0x320d57['where'],{'$or':_[_0xa5f6('0x36')](_0x320d57[_0xa5f6('0x3e')],function(_0xcdb63f){var _0x5f1330={};_0x5f1330[_0xcdb63f]={'$like':'%'+_0x5c33fb[_0xa5f6('0x3a')][_0xa5f6('0x45')]+'%'};return _0x5f1330;})});}_0x320d57=_[_0xa5f6('0x46')]({},_0x320d57,_0x5c33fb[_0xa5f6('0x49')]);return _0x38cabd[_0xa5f6('0x54')](_0x320d57);}})[_0xa5f6('0x1d')](function(_0x3fa66b){if(_0x3fa66b){_0xef3cb3=_0x3fa66b['length'];if(!_0x5c33fb['query']['hasOwnProperty']('nolimit')){_0x320d57['limit']=qs[_0xa5f6('0x2c')](_0x5c33fb[_0xa5f6('0x3a')][_0xa5f6('0x2c')]);_0x320d57[_0xa5f6('0x2b')]=qs[_0xa5f6('0x2b')](_0x5c33fb['query'][_0xa5f6('0x2b')]);}return _0x38cabd['getConfigurations'](_0x320d57);}})['then'](function(_0x3a04e0){if(_0x3a04e0){return _0x3a04e0?{'count':_0xef3cb3,'rows':_0x3a04e0}:null;}})[_0xa5f6('0x1d')](respondWithResult(_0x366639,null))['catch'](handleError(_0x366639,null));};exports[_0xa5f6('0x58')]=function(_0x200357,_0x4a9061,_0x9ac5f1){if(_0x200357[_0xa5f6('0x53')]['id']){delete _0x200357[_0xa5f6('0x53')]['id'];}return db[_0xa5f6('0x4a')]['findOne']({'where':{'id':_0x200357[_0xa5f6('0x50')]['id']}})['then'](handleEntityNotFound(_0x4a9061,null))[_0xa5f6('0x1d')](function(_0x1d1e80){if(_0x1d1e80){_0x200357['body'][_0xa5f6('0x59')]=_0x1d1e80['id'];_0x200357['body'][_0xa5f6('0x5a')]=integrations['getSubjects'](_0x200357[_0xa5f6('0x53')][_0xa5f6('0x5b')],_0x200357['body'][_0xa5f6('0x47')]);_0x200357[_0xa5f6('0x53')][_0xa5f6('0x5c')]=integrations[_0xa5f6('0x5d')](_0x200357['body'][_0xa5f6('0x5b')],_0x200357['body'][_0xa5f6('0x47')]);return db[_0xa5f6('0x56')]['create'](_0x200357[_0xa5f6('0x53')],{'include':[{'model':db[_0xa5f6('0x5e')],'as':_0xa5f6('0x5a')},{'model':db[_0xa5f6('0x5e')],'as':'Descriptions'}]});}return null;})[_0xa5f6('0x1d')](respondWithResult(_0x4a9061,null))['catch'](handleError(_0x4a9061,null));};exports[_0xa5f6('0x5f')]=function(_0x2436bb,_0x39d433,_0x1c9152){var _0x53c897=_0x2436bb[_0xa5f6('0x3a')][_0xa5f6('0x60')];var _0x2af829=_0x53c897===_0xa5f6('0x61')?_0xa5f6('0x62'):_0xa5f6('0x63');var _0x9b8051='';var _0x36f994='';var _0x56328d='';var _0x44a692='';var _0x3b46f7='';var _0x1c6d9b='';var _0x27c866='';var _0xecb49c='';var _0x302d07=[_0xa5f6('0x64'),_0xa5f6('0x65'),_0xa5f6('0x66'),_0xa5f6('0x67'),_0xa5f6('0x68'),_0xa5f6('0x69'),_0xa5f6('0x6a'),'regardingobjectid',_0xa5f6('0x6b'),'phonecall_activity_parties'];var _0x347f92=[_0xa5f6('0x6c'),_0xa5f6('0x6d'),_0xa5f6('0x6e'),'billedserviceunits',_0xa5f6('0x6f'),_0xa5f6('0x70'),_0xa5f6('0x71'),_0xa5f6('0x72'),_0xa5f6('0x73'),_0xa5f6('0x74'),_0xa5f6('0x75'),'createdbyyominame',_0xa5f6('0x76'),_0xa5f6('0x77'),'createdonbehalfbyyominame',_0xa5f6('0x78'),'customeridtype',_0xa5f6('0x79'),_0xa5f6('0x7a'),_0xa5f6('0x7b'),_0xa5f6('0x7c'),_0xa5f6('0x7d'),_0xa5f6('0x7e'),_0xa5f6('0x7f'),_0xa5f6('0x80'),_0xa5f6('0x81'),'importsequencenumber','influencescore',_0xa5f6('0x82'),'lastonholdtime',_0xa5f6('0x83'),_0xa5f6('0x84'),_0xa5f6('0x85'),_0xa5f6('0x86'),_0xa5f6('0x87'),_0xa5f6('0x88'),_0xa5f6('0x89'),_0xa5f6('0x8a'),'msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime',_0xa5f6('0x8b'),_0xa5f6('0x8c'),_0xa5f6('0x8d'),_0xa5f6('0x8e'),_0xa5f6('0x8f'),_0xa5f6('0x90'),_0xa5f6('0x91'),_0xa5f6('0x92'),_0xa5f6('0x93'),'productserialnumber',_0xa5f6('0x94'),_0xa5f6('0x95'),_0xa5f6('0x96'),_0xa5f6('0x97'),_0xa5f6('0x98'),_0xa5f6('0x99'),'slainvokedidname',_0xa5f6('0x9a'),'socialprofileidname',_0xa5f6('0x9b'),_0xa5f6('0x9c'),_0xa5f6('0x9d'),_0xa5f6('0x9e'),_0xa5f6('0x9f'),_0xa5f6('0xa0'),_0xa5f6('0xa1'),'utcconversiontimezonecode',_0xa5f6('0xa2')];var _0x1622cf=_0x302d07[_0xa5f6('0xa3')](_0x347f92);return db[_0xa5f6('0x4a')][_0xa5f6('0x55')]({'where':{'id':_0x2436bb[_0xa5f6('0x50')]['id']},'attributes':['id',_0xa5f6('0xa4'),'password','remoteUri','tenantId','clientId',_0xa5f6('0xa5')]})['then'](handleEntityNotFound(_0x39d433,null))[_0xa5f6('0x1d')](function(_0x5625e8){if(_0x5625e8){_0xecb49c=_0x5625e8['remoteUri'];var _0x505d72=_0xecb49c[_0xa5f6('0xa6')](-0x1);if(_0x505d72==='/'){_0xecb49c=_0xecb49c['substring'](0x0,_0xecb49c['lastIndexOf'](_0x505d72));}_0x27c866=util[_0xa5f6('0xa7')]('%s/api/data/v9.0/',_0xecb49c);var _0x2fcfa0={'method':_0xa5f6('0xa8'),'uri':_0xa5f6('0xa9')+_0x5625e8[_0xa5f6('0xaa')]+_0xa5f6('0xab'),'form':{'client_id':_0x5625e8[_0xa5f6('0xac')],'resource':_0xecb49c,'username':_0x5625e8[_0xa5f6('0xa4')],'password':_0x5625e8[_0xa5f6('0xad')],'grant_type':_0xa5f6('0xad'),'client_secret':_0x5625e8[_0xa5f6('0xa5')]},'json':!![]};return rp(_0x2fcfa0);}})[_0xa5f6('0x1d')](function(_0x431364){_0x1c6d9b=_0x431364[_0xa5f6('0xae')];var _0x3b7735={'method':_0xa5f6('0xaf'),'uri':encodeURI(_0x27c866+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x2af829+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1c6d9b,'If-None-Match':null,'OData-Version':_0xa5f6('0xb0')},'json':!![]};return rp(_0x3b7735);})['then'](function(_0x3c36bd){var _0x169b84=_0x3c36bd[_0xa5f6('0xb1')][0x0];var _0x4f5ea8=_0x169b84[_0xa5f6('0xb2')];var _0x43cd20={'method':'GET','uri':_0x27c866+_0xa5f6('0xb3')+_0x4f5ea8+_0xa5f6('0xb4'),'headers':{'Authorization':_0xa5f6('0xb5')+_0x1c6d9b,'If-None-Match':null,'OData-Version':_0xa5f6('0xb0')},'json':!![]};return rp(_0x43cd20);})[_0xa5f6('0x1d')](function(_0x32ecba){_0x9b8051=_0x32ecba;_0x36f994=_0x9b8051[_0xa5f6('0xb6')];_0x36f994=_[_0xa5f6('0xb7')](_0x36f994,function(_0x399946){return!_0x1622cf[_0xa5f6('0xb8')](_0x399946[_0xa5f6('0xb9')]);});var _0x3c9efb=[];var _0x4bce9d=[];_0x36f994[_0xa5f6('0xba')](function(_0x54b305){if(_0x54b305['@odata.type']){var _0x456c4=_0x54b305['@odata.type'][_0xa5f6('0xbb')](_0x54b305['@odata.type'][_0xa5f6('0xbc')]('.')+0x1);if(_0x456c4===_0xa5f6('0xbd')){_0x3c9efb[_0xa5f6('0xbe')](getSelectList(_0x27c866,_0x53c897,_0x4bce9d,_0x9b8051[_0xa5f6('0xb2')],_0x54b305[_0xa5f6('0xb2')],_0x1c6d9b));}}});return Promise[_0xa5f6('0xbf')](_0x3c9efb);})[_0xa5f6('0x1d')](function(_0x897dbc){_0x56328d=_0x897dbc[0x0];var _0x3ca9e7=[];var _0x2bafb9=[];_0x36f994[_0xa5f6('0xba')](function(_0x3f828b){if(!_[_0xa5f6('0xc0')](_0x3f828b[_0xa5f6('0xc1')])){var _0x21451b=_0x3f828b[_0xa5f6('0xc1')][_0xa5f6('0xbb')](_0x3f828b[_0xa5f6('0xc1')][_0xa5f6('0xbc')]('.')+0x1);if(_0x21451b==='BooleanAttributeMetadata'){_0x3ca9e7['push'](getBooleanList(_0x27c866,_0x53c897,_0x2bafb9,_0x9b8051[_0xa5f6('0xb2')],_0x3f828b['MetadataId'],_0x1c6d9b));}}});return Promise[_0xa5f6('0xbf')](_0x3ca9e7);})[_0xa5f6('0x1d')](function(_0x4bd932){_0x44a692=_0x4bd932[0x0];var _0x4756eb=[];var _0x340a3d=[];_0x36f994[_0xa5f6('0xba')](function(_0x5ee53c){if(_0x5ee53c[_0xa5f6('0xc1')]){var _0x1cc47e=_0x5ee53c[_0xa5f6('0xc1')][_0xa5f6('0xbb')](_0x5ee53c['@odata.type'][_0xa5f6('0xbc')]('.')+0x1);if(_0x1cc47e===_0xa5f6('0xc2')||_0x1cc47e===_0xa5f6('0xc3')||_0x1cc47e==='BigIntAttributeMetadata'||_0x1cc47e===_0xa5f6('0xc4')||_0x1cc47e===_0xa5f6('0xc5')||_0x1cc47e==='DateTimeAttributeMetadata'||_0x1cc47e==='StatusAttributeMetadata'||_0x1cc47e==='EntityNameAttributeMetadata'||_0x1cc47e==='StateAttributeMetadata'||_0x1cc47e==='DecimalAttributeMetadata'){_0x4756eb[_0xa5f6('0xbe')](getInputList(_0x27c866,_0x53c897,_0x1cc47e,_0x340a3d,_0x9b8051[_0xa5f6('0xb2')],_0x5ee53c[_0xa5f6('0xb2')],_0x1c6d9b));}}});return Promise[_0xa5f6('0xbf')](_0x4756eb);})['then'](function(_0xde3eaa){_0x3b46f7=_0xde3eaa[0x0];var _0xb65e98=_0x56328d[_0xa5f6('0xa3')](_0x44a692)['concat'](_0x3b46f7);var _0x395432={'count':_0xb65e98[_0xa5f6('0x40')],'rows':_0xb65e98};return _0x395432;})[_0xa5f6('0x1d')](respondWithResult(_0x39d433,null))['catch'](function(_0x41e25e){var _0x17b27a=_0x2436bb[_0xa5f6('0x3a')][_0xa5f6('0x1a')]?0x1f4:_0x41e25e[_0xa5f6('0xc6')]||0x1f4;logger['error'](_0x41e25e[_0xa5f6('0x33')]);delete _0x41e25e[_0xa5f6('0x34')];if(_0x17b27a===0x191){_0x17b27a=0x190;}_0x39d433[_0xa5f6('0x27')](_0x17b27a)[_0xa5f6('0x35')](_0x2436bb[_0xa5f6('0x3a')]['test']?{'message':_0xa5f6('0xc7'),'statusCode':_0x41e25e[_0xa5f6('0xc6')]}:_0x41e25e);});};function getSelectList(_0xb7b480,_0x39680c,_0x6c216d,_0xd69e44,_0x498748,_0x1f502d){var _0x5d9da6={'method':'GET','uri':_0xb7b480+_0xa5f6('0xb3')+_0xd69e44+_0xa5f6('0xc8')+_0x498748+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x1f502d,'If-None-Match':null,'OData-Version':_0xa5f6('0xb0')},'json':!![]};return rp(_0x5d9da6)[_0xa5f6('0x1d')](function(_0x429f6){var _0x30d918=[];var _0x1cf050=_0x429f6[_0xa5f6('0xc9')]['Options'];_0x1cf050[_0xa5f6('0xba')](function(_0x1aed07){_0x30d918[_0xa5f6('0xbe')]({'name':_0x1aed07['Label'][_0xa5f6('0xca')][_0xa5f6('0xcb')],'value':String(_0x1aed07[_0xa5f6('0xcc')])});});var _0x3bd161={'id':_0x39680c+'_'+_0x429f6[_0xa5f6('0xb9')],'name':_0x429f6[_0xa5f6('0xcd')][_0xa5f6('0xca')][_0xa5f6('0xcb')],'custom':![],'options':_0x30d918};_0x6c216d[_0xa5f6('0xbe')](_0x3bd161);return _0x6c216d;});}function getBooleanList(_0xa5c7c7,_0x26573e,_0xf5816,_0x5a48d5,_0x1ab3bd,_0x1aff14){var _0x1f527f={'method':_0xa5f6('0xaf'),'uri':_0xa5c7c7+_0xa5f6('0xb3')+_0x5a48d5+_0xa5f6('0xc8')+_0x1ab3bd+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xa5f6('0xb5')+_0x1aff14,'If-None-Match':null,'OData-Version':_0xa5f6('0xb0')},'json':!![]};return rp(_0x1f527f)[_0xa5f6('0x1d')](function(_0x2a6037){var _0x279f3a=[];_0x279f3a[_0xa5f6('0xbe')]({'name':_0x2a6037[_0xa5f6('0xc9')][_0xa5f6('0xce')]['Label'][_0xa5f6('0xca')][_0xa5f6('0xcb')],'value':_0xa5f6('0xcf')},{'name':_0x2a6037['OptionSet'][_0xa5f6('0xd0')][_0xa5f6('0xcb')][_0xa5f6('0xca')][_0xa5f6('0xcb')],'value':_0xa5f6('0xd1')});var _0x1b232a={'id':_0x26573e+'_'+_0x2a6037['LogicalName'],'name':_0x2a6037[_0xa5f6('0xcd')][_0xa5f6('0xca')][_0xa5f6('0xcb')],'custom':![],'options':_0x279f3a};_0xf5816['push'](_0x1b232a);return _0xf5816;});}function getInputList(_0x582028,_0x11ac13,_0x2d078d,_0x36bd6e,_0x43ae3f,_0x584fc0,_0x213868){var _0x4c1c14={'method':_0xa5f6('0xaf'),'uri':_0x582028+_0xa5f6('0xb3')+_0x43ae3f+')/Attributes('+_0x584fc0+_0xa5f6('0xd2')+_0x2d078d+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xa5f6('0xb5')+_0x213868,'If-None-Match':null,'OData-Version':_0xa5f6('0xb0')},'json':!![]};return rp(_0x4c1c14)[_0xa5f6('0x1d')](function(_0x3f454c){var _0x191f34={'id':_0x11ac13+'_'+_0x3f454c[_0xa5f6('0xb9')],'name':_0x3f454c[_0xa5f6('0xcd')][_0xa5f6('0xca')]?_0x3f454c[_0xa5f6('0xcd')][_0xa5f6('0xca')][_0xa5f6('0xcb')]:_0x3f454c[_0xa5f6('0xb9')],'custom':![],'options':[]};_0x36bd6e[_0xa5f6('0xbe')](_0x191f34);return _0x36bd6e;});}
\ No newline at end of file
+var _0x46ed=['rows','params','length','options','find','create','body','getConfigurations','Dynamics365Configuration','filter','hasOwnProperty','nolimit','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','phonecall_activity_parties','accountidname','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','entitlementidname','entityimage_url','escalatedon','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','@odata.type','PicklistAttributeMetadata','all','forEach','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','statusCode','Wrong\x20credentials','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','Dynamics365Account','fieldName','key','model','keys','query','filters','intersection','attributes','fields','order','sort','where','pick','type','VIRTUAL','merge','includeAll','include'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x46ed,0x168));var _0xd46e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x46ed[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0xd46e('0x0'));var emlformat=require(_0xd46e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd46e('0x2'));var jsonpatch=require(_0xd46e('0x3'));var rp=require(_0xd46e('0x4'));var moment=require('moment');var BPromise=require(_0xd46e('0x5'));var Mustache=require(_0xd46e('0x6'));var util=require('util');var path=require(_0xd46e('0x7'));var sox=require(_0xd46e('0x8'));var csv=require(_0xd46e('0x9'));var ejs=require(_0xd46e('0xa'));var fs=require('fs');var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x9'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xd46e('0x1a')][_0xd46e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x53b309,_0x5a3076,_0xacd799,_0x4688ae){return new BPromise(function(_0x1e9aae,_0x3fdf88){var _0x50c7c3=_0x4688ae||client;return _0x50c7c3[_0xd46e('0x1c')](_0x53b309,_0xacd799)[_0xd46e('0x1d')](function(_0x417402){logger[_0xd46e('0x1e')](_0xd46e('0x1f'),_0x5a3076,'request\x20sent');logger[_0xd46e('0x20')](_0xd46e('0x21'),_0x5a3076,_0xd46e('0x22'),JSON['stringify'](_0x417402));if(_0x417402['error']){if(_0x417402[_0xd46e('0x23')][_0xd46e('0x24')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5a3076,_0x417402[_0xd46e('0x23')][_0xd46e('0x25')]);return _0x3fdf88(_0x417402[_0xd46e('0x23')][_0xd46e('0x25')]);}logger[_0xd46e('0x23')](_0xd46e('0x1f'),_0x5a3076,_0x417402[_0xd46e('0x23')][_0xd46e('0x25')]);return _0x1e9aae(_0x417402[_0xd46e('0x23')][_0xd46e('0x25')]);}else{logger[_0xd46e('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x5a3076,_0xd46e('0x22'));_0x1e9aae(_0x417402[_0xd46e('0x26')][_0xd46e('0x25')]);}})[_0xd46e('0x27')](function(_0x128246){logger[_0xd46e('0x23')](_0xd46e('0x1f'),_0x5a3076,_0x128246);_0x3fdf88(_0x128246);});});}function respondWithStatusCode(_0x8a1be,_0x62dea5){_0x62dea5=_0x62dea5||0xcc;return function(_0x4cf899){if(_0x4cf899){return _0x8a1be[_0xd46e('0x28')](_0x62dea5);}return _0x8a1be['status'](_0x62dea5)['end']();};}function respondWithResult(_0x371054,_0x2a5271){_0x2a5271=_0x2a5271||0xc8;return function(_0x21135f){if(_0x21135f){return _0x371054[_0xd46e('0x29')](_0x2a5271)[_0xd46e('0x2a')](_0x21135f);}};}function respondWithFilteredResult(_0x180851,_0x1740d1){return function(_0x4dab6a){if(_0x4dab6a){var _0x45d789=_0x4dab6a[_0xd46e('0x2b')],_0x3c301a=_0x1740d1[_0xd46e('0x2c')],_0xddbce9=_0x1740d1['offset']+_0x1740d1[_0xd46e('0x2d')],_0x17db79;if(_0xddbce9>=_0x45d789){_0xddbce9=_0x45d789;_0x17db79=0xc8;}else{_0x17db79=0xce;}_0x180851[_0xd46e('0x29')](_0x17db79);return _0x180851[_0xd46e('0x2e')](_0xd46e('0x2f'),_0x3c301a+'-'+_0xddbce9+'/'+_0x45d789)[_0xd46e('0x2a')](_0x4dab6a);}return null;};}function patchUpdates(_0x423ea3){return function(_0x147da3){try{jsonpatch[_0xd46e('0x30')](_0x147da3,_0x423ea3,!![]);}catch(_0x18f060){return BPromise[_0xd46e('0x31')](_0x18f060);}return _0x147da3[_0xd46e('0x32')]();};}function saveUpdates(_0x504324,_0x2f4a1b){return function(_0x5ed8dc){if(_0x5ed8dc){return _0x5ed8dc[_0xd46e('0x33')](_0x504324)[_0xd46e('0x1d')](function(_0x4f5718){return _0x4f5718;});}return null;};}function removeEntity(_0x3f01a7,_0x5ef248){return function(_0x2eed3a){if(_0x2eed3a){return _0x2eed3a[_0xd46e('0x34')]()['then'](function(){_0x3f01a7[_0xd46e('0x29')](0xcc)[_0xd46e('0x35')]();});}};}function handleEntityNotFound(_0x4839e0,_0x306458){return function(_0x1c15c9){if(!_0x1c15c9){_0x4839e0[_0xd46e('0x28')](0x194);}return _0x1c15c9;};}function handleError(_0x4b5e50,_0x576449){_0x576449=_0x576449||0x1f4;return function(_0x10688f){logger[_0xd46e('0x23')](_0x10688f[_0xd46e('0x36')]);if(_0x10688f[_0xd46e('0x37')]){delete _0x10688f[_0xd46e('0x37')];}_0x4b5e50[_0xd46e('0x29')](_0x576449)[_0xd46e('0x38')](_0x10688f);};}exports[_0xd46e('0x39')]=function(_0x527a2f,_0x4fb62e){var _0x1a1181={},_0x15e35c={},_0x83aec1={'count':0x0,'rows':[]};var _0x1fa66c=_[_0xd46e('0x3a')](db[_0xd46e('0x3b')]['rawAttributes'],function(_0x163dd0){return{'name':_0x163dd0[_0xd46e('0x3c')],'type':_0x163dd0['type'][_0xd46e('0x3d')]};});_0x15e35c[_0xd46e('0x3e')]=_[_0xd46e('0x3a')](_0x1fa66c,_0xd46e('0x37'));_0x15e35c['query']=_[_0xd46e('0x3f')](_0x527a2f[_0xd46e('0x40')]);_0x15e35c[_0xd46e('0x41')]=_[_0xd46e('0x42')](_0x15e35c[_0xd46e('0x3e')],_0x15e35c[_0xd46e('0x40')]);_0x1a1181[_0xd46e('0x43')]=_[_0xd46e('0x42')](_0x15e35c['model'],qs[_0xd46e('0x44')](_0x527a2f[_0xd46e('0x40')][_0xd46e('0x44')]));_0x1a1181[_0xd46e('0x43')]=_0x1a1181[_0xd46e('0x43')]['length']?_0x1a1181[_0xd46e('0x43')]:_0x15e35c['model'];if(!_0x527a2f['query']['hasOwnProperty']('nolimit')){_0x1a1181[_0xd46e('0x2d')]=qs['limit'](_0x527a2f[_0xd46e('0x40')][_0xd46e('0x2d')]);_0x1a1181['offset']=qs[_0xd46e('0x2c')](_0x527a2f[_0xd46e('0x40')][_0xd46e('0x2c')]);}_0x1a1181[_0xd46e('0x45')]=qs[_0xd46e('0x46')](_0x527a2f[_0xd46e('0x40')][_0xd46e('0x46')]);_0x1a1181[_0xd46e('0x47')]=qs[_0xd46e('0x41')](_[_0xd46e('0x48')](_0x527a2f[_0xd46e('0x40')],_0x15e35c['filters']),_0x1fa66c);if(_0x527a2f['query']['filter']){_0x1a1181[_0xd46e('0x47')]=_['merge'](_0x1a1181[_0xd46e('0x47')],{'$or':_[_0xd46e('0x3a')](_0x1fa66c,function(_0x3fdf67){if(_0x3fdf67[_0xd46e('0x49')]!==_0xd46e('0x4a')){var _0x5d180e={};_0x5d180e[_0x3fdf67[_0xd46e('0x37')]]={'$like':'%'+_0x527a2f[_0xd46e('0x40')]['filter']+'%'};return _0x5d180e;}})});}_0x1a1181=_[_0xd46e('0x4b')]({},_0x1a1181,_0x527a2f['options']);var _0x22f592={'where':_0x1a1181[_0xd46e('0x47')]};return db[_0xd46e('0x3b')][_0xd46e('0x2b')](_0x22f592)[_0xd46e('0x1d')](function(_0x5d65ca){_0x83aec1[_0xd46e('0x2b')]=_0x5d65ca;if(_0x527a2f[_0xd46e('0x40')][_0xd46e('0x4c')]){_0x1a1181[_0xd46e('0x4d')]=[{'all':!![]}];}return db[_0xd46e('0x3b')]['findAll'](_0x1a1181);})[_0xd46e('0x1d')](function(_0x369001){_0x83aec1[_0xd46e('0x4e')]=_0x369001;return _0x83aec1;})[_0xd46e('0x1d')](respondWithFilteredResult(_0x4fb62e,_0x1a1181))[_0xd46e('0x27')](handleError(_0x4fb62e,null));};exports['show']=function(_0x341d9f,_0x3ea9e6){var _0x45baf1={'raw':![],'where':{'id':_0x341d9f[_0xd46e('0x4f')]['id']}},_0x3c59ec={};_0x3c59ec[_0xd46e('0x3e')]=_[_0xd46e('0x3f')](db[_0xd46e('0x3b')]['rawAttributes']);_0x3c59ec[_0xd46e('0x40')]=_[_0xd46e('0x3f')](_0x341d9f[_0xd46e('0x40')]);_0x3c59ec[_0xd46e('0x41')]=_[_0xd46e('0x42')](_0x3c59ec['model'],_0x3c59ec['query']);_0x45baf1[_0xd46e('0x43')]=_[_0xd46e('0x42')](_0x3c59ec[_0xd46e('0x3e')],qs['fields'](_0x341d9f['query'][_0xd46e('0x44')]));_0x45baf1[_0xd46e('0x43')]=_0x45baf1['attributes'][_0xd46e('0x50')]?_0x45baf1[_0xd46e('0x43')]:_0x3c59ec[_0xd46e('0x3e')];if(_0x341d9f[_0xd46e('0x40')][_0xd46e('0x4c')]){_0x45baf1[_0xd46e('0x4d')]=[{'all':!![]}];}_0x45baf1=_[_0xd46e('0x4b')]({},_0x45baf1,_0x341d9f[_0xd46e('0x51')]);return db['Dynamics365Account'][_0xd46e('0x52')](_0x45baf1)[_0xd46e('0x1d')](handleEntityNotFound(_0x3ea9e6,null))[_0xd46e('0x1d')](respondWithResult(_0x3ea9e6,null))[_0xd46e('0x27')](handleError(_0x3ea9e6,null));};exports['create']=function(_0x56dd9a,_0xced102){return db['Dynamics365Account'][_0xd46e('0x53')](_0x56dd9a[_0xd46e('0x54')],{})[_0xd46e('0x1d')](respondWithResult(_0xced102,0xc9))[_0xd46e('0x27')](handleError(_0xced102,null));};exports[_0xd46e('0x33')]=function(_0x38dfa7,_0x492329){if(_0x38dfa7[_0xd46e('0x54')]['id']){delete _0x38dfa7[_0xd46e('0x54')]['id'];}return db[_0xd46e('0x3b')]['find']({'where':{'id':_0x38dfa7[_0xd46e('0x4f')]['id']}})[_0xd46e('0x1d')](handleEntityNotFound(_0x492329,null))[_0xd46e('0x1d')](saveUpdates(_0x38dfa7[_0xd46e('0x54')],null))[_0xd46e('0x1d')](respondWithResult(_0x492329,null))[_0xd46e('0x27')](handleError(_0x492329,null));};exports[_0xd46e('0x34')]=function(_0x381256,_0x3508f4){return db[_0xd46e('0x3b')][_0xd46e('0x52')]({'where':{'id':_0x381256[_0xd46e('0x4f')]['id']}})[_0xd46e('0x1d')](handleEntityNotFound(_0x3508f4,null))[_0xd46e('0x1d')](removeEntity(_0x3508f4,null))['catch'](handleError(_0x3508f4,null));};exports[_0xd46e('0x55')]=function(_0x37a22f,_0xe0cd61,_0x46bb2f){var _0x5acce1={};var _0x636f15={};var _0x36e18a;var _0xaf9641;return db[_0xd46e('0x3b')]['findOne']({'where':{'id':_0x37a22f[_0xd46e('0x4f')]['id']}})[_0xd46e('0x1d')](handleEntityNotFound(_0xe0cd61,null))['then'](function(_0x5a5832){if(_0x5a5832){_0x36e18a=_0x5a5832;_0x636f15[_0xd46e('0x3e')]=_[_0xd46e('0x3f')](db[_0xd46e('0x56')]['rawAttributes']);_0x636f15['query']=_[_0xd46e('0x3f')](_0x37a22f[_0xd46e('0x40')]);_0x636f15[_0xd46e('0x41')]=_[_0xd46e('0x42')](_0x636f15[_0xd46e('0x3e')],_0x636f15[_0xd46e('0x40')]);_0x5acce1[_0xd46e('0x43')]=_[_0xd46e('0x42')](_0x636f15[_0xd46e('0x3e')],qs[_0xd46e('0x44')](_0x37a22f[_0xd46e('0x40')][_0xd46e('0x44')]));_0x5acce1[_0xd46e('0x43')]=_0x5acce1[_0xd46e('0x43')][_0xd46e('0x50')]?_0x5acce1[_0xd46e('0x43')]:_0x636f15['model'];_0x5acce1[_0xd46e('0x45')]=qs[_0xd46e('0x46')](_0x37a22f[_0xd46e('0x40')]['sort']);_0x5acce1[_0xd46e('0x47')]=qs[_0xd46e('0x41')](_['pick'](_0x37a22f[_0xd46e('0x40')],_0x636f15[_0xd46e('0x41')]));if(_0x37a22f[_0xd46e('0x40')]['filter']){_0x5acce1[_0xd46e('0x47')]=_[_0xd46e('0x4b')](_0x5acce1[_0xd46e('0x47')],{'$or':_['map'](_0x5acce1[_0xd46e('0x43')],function(_0x516e7d){var _0x32eed0={};_0x32eed0[_0x516e7d]={'$like':'%'+_0x37a22f[_0xd46e('0x40')][_0xd46e('0x57')]+'%'};return _0x32eed0;})});}_0x5acce1=_['merge']({},_0x5acce1,_0x37a22f[_0xd46e('0x51')]);return _0x36e18a[_0xd46e('0x55')](_0x5acce1);}})[_0xd46e('0x1d')](function(_0xbce76f){if(_0xbce76f){_0xaf9641=_0xbce76f[_0xd46e('0x50')];if(!_0x37a22f[_0xd46e('0x40')][_0xd46e('0x58')](_0xd46e('0x59'))){_0x5acce1[_0xd46e('0x2d')]=qs[_0xd46e('0x2d')](_0x37a22f[_0xd46e('0x40')][_0xd46e('0x2d')]);_0x5acce1[_0xd46e('0x2c')]=qs[_0xd46e('0x2c')](_0x37a22f['query']['offset']);}return _0x36e18a[_0xd46e('0x55')](_0x5acce1);}})[_0xd46e('0x1d')](function(_0x299ca7){if(_0x299ca7){return _0x299ca7?{'count':_0xaf9641,'rows':_0x299ca7}:null;}})[_0xd46e('0x1d')](respondWithResult(_0xe0cd61,null))[_0xd46e('0x27')](handleError(_0xe0cd61,null));};exports['addConfiguration']=function(_0x1ed069,_0x9ea442,_0xfb4073){if(_0x1ed069[_0xd46e('0x54')]['id']){delete _0x1ed069['body']['id'];}return db[_0xd46e('0x3b')][_0xd46e('0x5a')]({'where':{'id':_0x1ed069['params']['id']}})[_0xd46e('0x1d')](handleEntityNotFound(_0x9ea442,null))[_0xd46e('0x1d')](function(_0x4ad93f){if(_0x4ad93f){_0x1ed069[_0xd46e('0x54')][_0xd46e('0x5b')]=_0x4ad93f['id'];_0x1ed069['body'][_0xd46e('0x5c')]=integrations['getSubjects'](_0x1ed069[_0xd46e('0x54')][_0xd46e('0x5d')],_0x1ed069['body']['type']);_0x1ed069[_0xd46e('0x54')][_0xd46e('0x5e')]=integrations[_0xd46e('0x5f')](_0x1ed069[_0xd46e('0x54')]['channel'],_0x1ed069[_0xd46e('0x54')][_0xd46e('0x49')]);return db['Dynamics365Configuration'][_0xd46e('0x53')](_0x1ed069[_0xd46e('0x54')],{'include':[{'model':db[_0xd46e('0x60')],'as':_0xd46e('0x5c')},{'model':db[_0xd46e('0x60')],'as':_0xd46e('0x5e')}]});}return null;})[_0xd46e('0x1d')](respondWithResult(_0x9ea442,null))[_0xd46e('0x27')](handleError(_0x9ea442,null));};exports[_0xd46e('0x61')]=function(_0x556fed,_0x2bfffc,_0x1c1bae){var _0x5ce170=_0x556fed[_0xd46e('0x40')][_0xd46e('0x62')];var _0x1a28c1=_0x5ce170===_0xd46e('0x63')?_0xd46e('0x64'):_0xd46e('0x65');var _0x48c68e='';var _0x553496='';var _0x1ed97e='';var _0x1c0afd='';var _0x5cdaf9='';var _0x4cb510='';var _0x484805='';var _0x825746='';var _0x1f88f2=[_0xd46e('0x66'),'description',_0xd46e('0x67'),_0xd46e('0x68'),_0xd46e('0x69'),'subject','phonenumber','regardingobjectid','directioncode',_0xd46e('0x6a')];var _0x5d7c51=[_0xd46e('0x6b'),'accountidyominame','actualserviceunits',_0xd46e('0x6c'),_0xd46e('0x6d'),_0xd46e('0x6e'),_0xd46e('0x6f'),_0xd46e('0x70'),_0xd46e('0x71'),'createdbyexternalpartyyominame','createdbyname',_0xd46e('0x72'),_0xd46e('0x73'),_0xd46e('0x74'),_0xd46e('0x75'),'customeridname',_0xd46e('0x76'),_0xd46e('0x77'),'emailaddress',_0xd46e('0x78'),'entityimage_timestamp',_0xd46e('0x79'),_0xd46e('0x7a'),'exchangerate','firstresponsebykpiidname',_0xd46e('0x7b'),_0xd46e('0x7c'),_0xd46e('0x7d'),'kbarticleidname',_0xd46e('0x7e'),_0xd46e('0x7f'),_0xd46e('0x80'),_0xd46e('0x81'),_0xd46e('0x82'),_0xd46e('0x83'),_0xd46e('0x84'),_0xd46e('0x85'),_0xd46e('0x86'),_0xd46e('0x87'),_0xd46e('0x88'),_0xd46e('0x89'),_0xd46e('0x8a'),_0xd46e('0x8b'),_0xd46e('0x8c'),_0xd46e('0x8d'),_0xd46e('0x8e'),_0xd46e('0x8f'),'primarycontactidname',_0xd46e('0x90'),'prioritycodename',_0xd46e('0x91'),_0xd46e('0x92'),'resolveby',_0xd46e('0x93'),_0xd46e('0x94'),_0xd46e('0x95'),_0xd46e('0x96'),_0xd46e('0x97'),_0xd46e('0x98'),_0xd46e('0x99'),_0xd46e('0x9a'),_0xd46e('0x9b'),_0xd46e('0x9c'),_0xd46e('0x9d'),'ticketnumber','timezoneruleversionnumber',_0xd46e('0x9e'),_0xd46e('0x9f'),_0xd46e('0xa0'),_0xd46e('0xa1')];var _0x3ce56f=_0x1f88f2[_0xd46e('0xa2')](_0x5d7c51);return db['Dynamics365Account'][_0xd46e('0x5a')]({'where':{'id':_0x556fed[_0xd46e('0x4f')]['id']},'attributes':['id',_0xd46e('0xa3'),_0xd46e('0xa4'),_0xd46e('0xa5'),_0xd46e('0xa6'),'clientId',_0xd46e('0xa7')]})[_0xd46e('0x1d')](handleEntityNotFound(_0x2bfffc,null))['then'](function(_0x3c8d68){if(_0x3c8d68){_0x825746=_0x3c8d68[_0xd46e('0xa5')];var _0x9e222d=_0x825746[_0xd46e('0xa8')](-0x1);if(_0x9e222d==='/'){_0x825746=_0x825746[_0xd46e('0xa9')](0x0,_0x825746[_0xd46e('0xaa')](_0x9e222d));}_0x484805=util[_0xd46e('0xab')](_0xd46e('0xac'),_0x825746);var _0x3469bd={'method':_0xd46e('0xad'),'uri':_0xd46e('0xae')+_0x3c8d68[_0xd46e('0xa6')]+_0xd46e('0xaf'),'form':{'client_id':_0x3c8d68[_0xd46e('0xb0')],'resource':_0x825746,'username':_0x3c8d68['username'],'password':_0x3c8d68['password'],'grant_type':_0xd46e('0xa4'),'client_secret':_0x3c8d68[_0xd46e('0xa7')]},'json':!![]};return rp(_0x3469bd);}})[_0xd46e('0x1d')](function(_0x268467){_0x4cb510=_0x268467[_0xd46e('0xb1')];var _0x3b7ec6={'method':'GET','uri':encodeURI(_0x484805+_0xd46e('0xb2')+_0x1a28c1+'\x27'),'headers':{'Authorization':_0xd46e('0xb3')+_0x4cb510,'If-None-Match':null,'OData-Version':_0xd46e('0xb4')},'json':!![]};return rp(_0x3b7ec6);})[_0xd46e('0x1d')](function(_0x58b2ca){var _0x2f08a8=_0x58b2ca[_0xd46e('0xb5')][0x0];var _0x5f11f7=_0x2f08a8[_0xd46e('0xb6')];var _0x4b3371={'method':'GET','uri':_0x484805+_0xd46e('0xb7')+_0x5f11f7+_0xd46e('0xb8'),'headers':{'Authorization':_0xd46e('0xb3')+_0x4cb510,'If-None-Match':null,'OData-Version':_0xd46e('0xb4')},'json':!![]};return rp(_0x4b3371);})['then'](function(_0x565b38){_0x48c68e=_0x565b38;_0x553496=_0x48c68e[_0xd46e('0xb9')];_0x553496=_['remove'](_0x553496,function(_0x3bea4d){return!_0x3ce56f['includes'](_0x3bea4d['LogicalName']);});var _0xd7a4ab=[];var _0x323aac=[];_0x553496['forEach'](function(_0x573d90){if(_0x573d90[_0xd46e('0xba')]){var _0x3eb448=_0x573d90[_0xd46e('0xba')][_0xd46e('0xa9')](_0x573d90['@odata.type'][_0xd46e('0xaa')]('.')+0x1);if(_0x3eb448===_0xd46e('0xbb')){_0xd7a4ab['push'](getSelectList(_0x484805,_0x5ce170,_0x323aac,_0x48c68e[_0xd46e('0xb6')],_0x573d90[_0xd46e('0xb6')],_0x4cb510));}}});return Promise[_0xd46e('0xbc')](_0xd7a4ab);})[_0xd46e('0x1d')](function(_0x263999){_0x1ed97e=_0x263999[0x0];var _0x2c4a1d=[];var _0x55739b=[];_0x553496[_0xd46e('0xbd')](function(_0x38a92){if(!_['isNil'](_0x38a92['@odata.type'])){var _0x44202b=_0x38a92[_0xd46e('0xba')]['substring'](_0x38a92['@odata.type'][_0xd46e('0xaa')]('.')+0x1);if(_0x44202b===_0xd46e('0xbe')){_0x2c4a1d['push'](getBooleanList(_0x484805,_0x5ce170,_0x55739b,_0x48c68e[_0xd46e('0xb6')],_0x38a92[_0xd46e('0xb6')],_0x4cb510));}}});return Promise[_0xd46e('0xbc')](_0x2c4a1d);})[_0xd46e('0x1d')](function(_0x225d12){_0x1c0afd=_0x225d12[0x0];var _0x364797=[];var _0x52e050=[];_0x553496[_0xd46e('0xbd')](function(_0x26f757){if(_0x26f757[_0xd46e('0xba')]){var _0x3fcc47=_0x26f757[_0xd46e('0xba')][_0xd46e('0xa9')](_0x26f757[_0xd46e('0xba')][_0xd46e('0xaa')]('.')+0x1);if(_0x3fcc47===_0xd46e('0xbf')||_0x3fcc47===_0xd46e('0xc0')||_0x3fcc47===_0xd46e('0xc1')||_0x3fcc47==='IntegerAttributeMetadata'||_0x3fcc47===_0xd46e('0xc2')||_0x3fcc47==='DateTimeAttributeMetadata'||_0x3fcc47==='StatusAttributeMetadata'||_0x3fcc47===_0xd46e('0xc3')||_0x3fcc47===_0xd46e('0xc4')||_0x3fcc47===_0xd46e('0xc5')){_0x364797[_0xd46e('0xc6')](getInputList(_0x484805,_0x5ce170,_0x3fcc47,_0x52e050,_0x48c68e[_0xd46e('0xb6')],_0x26f757[_0xd46e('0xb6')],_0x4cb510));}}});return Promise[_0xd46e('0xbc')](_0x364797);})[_0xd46e('0x1d')](function(_0x57c2e2){_0x5cdaf9=_0x57c2e2[0x0];var _0x2450b9=_0x1ed97e['concat'](_0x1c0afd)[_0xd46e('0xa2')](_0x5cdaf9);var _0x372404={'count':_0x2450b9[_0xd46e('0x50')],'rows':_0x2450b9};return _0x372404;})[_0xd46e('0x1d')](respondWithResult(_0x2bfffc,null))[_0xd46e('0x27')](function(_0x399918){var _0x277877=_0x556fed[_0xd46e('0x40')]['test']?0x1f4:_0x399918[_0xd46e('0xc7')]||0x1f4;logger[_0xd46e('0x23')](_0x399918[_0xd46e('0x36')]);delete _0x399918['name'];if(_0x277877===0x191){_0x277877=0x190;}_0x2bfffc[_0xd46e('0x29')](_0x277877)[_0xd46e('0x38')](_0x556fed[_0xd46e('0x40')]['test']?{'message':_0xd46e('0xc8'),'statusCode':_0x399918[_0xd46e('0xc7')]}:_0x399918);});};function getSelectList(_0x16588b,_0x2019a6,_0x44d4b6,_0xba9d7f,_0x4bc14f,_0x4967ff){var _0x57e71d={'method':_0xd46e('0xc9'),'uri':_0x16588b+'EntityDefinitions('+_0xba9d7f+_0xd46e('0xca')+_0x4bc14f+_0xd46e('0xcb')+_0xd46e('0xcc'),'headers':{'Authorization':_0xd46e('0xb3')+_0x4967ff,'If-None-Match':null,'OData-Version':_0xd46e('0xb4')},'json':!![]};return rp(_0x57e71d)[_0xd46e('0x1d')](function(_0x4bb76b){var _0x59a715=[];var _0x204a9f=_0x4bb76b['OptionSet'][_0xd46e('0xcd')];_0x204a9f[_0xd46e('0xbd')](function(_0x581b58){_0x59a715[_0xd46e('0xc6')]({'name':_0x581b58[_0xd46e('0xce')][_0xd46e('0xcf')][_0xd46e('0xce')],'value':String(_0x581b58[_0xd46e('0xd0')])});});var _0x537c73={'id':_0x2019a6+'_'+_0x4bb76b[_0xd46e('0xd1')],'name':_0x4bb76b[_0xd46e('0xd2')][_0xd46e('0xcf')][_0xd46e('0xce')],'custom':![],'options':_0x59a715};_0x44d4b6[_0xd46e('0xc6')](_0x537c73);return _0x44d4b6;});}function getBooleanList(_0x20587c,_0x368742,_0x124171,_0x1ad70b,_0x2d745a,_0x37150e){var _0x1db1a1={'method':_0xd46e('0xc9'),'uri':_0x20587c+_0xd46e('0xb7')+_0x1ad70b+')/Attributes('+_0x2d745a+_0xd46e('0xd3'),'headers':{'Authorization':_0xd46e('0xb3')+_0x37150e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1db1a1)[_0xd46e('0x1d')](function(_0x2c7c60){var _0x103ee0=[];_0x103ee0['push']({'name':_0x2c7c60[_0xd46e('0xd4')][_0xd46e('0xd5')][_0xd46e('0xce')][_0xd46e('0xcf')]['Label'],'value':_0xd46e('0xd6')},{'name':_0x2c7c60[_0xd46e('0xd4')][_0xd46e('0xd7')]['Label']['UserLocalizedLabel'][_0xd46e('0xce')],'value':_0xd46e('0xd8')});var _0x85aac1={'id':_0x368742+'_'+_0x2c7c60[_0xd46e('0xd1')],'name':_0x2c7c60[_0xd46e('0xd2')][_0xd46e('0xcf')]['Label'],'custom':![],'options':_0x103ee0};_0x124171[_0xd46e('0xc6')](_0x85aac1);return _0x124171;});}function getInputList(_0x51f968,_0x4d267b,_0x49c2ba,_0x5d25f7,_0x4a29d6,_0x4e431d,_0x1558f3){var _0x1e1aee={'method':_0xd46e('0xc9'),'uri':_0x51f968+_0xd46e('0xb7')+_0x4a29d6+_0xd46e('0xca')+_0x4e431d+_0xd46e('0xd9')+_0x49c2ba+_0xd46e('0xda'),'headers':{'Authorization':'Bearer\x20'+_0x1558f3,'If-None-Match':null,'OData-Version':_0xd46e('0xb4')},'json':!![]};return rp(_0x1e1aee)[_0xd46e('0x1d')](function(_0x1b9155){var _0x283798={'id':_0x4d267b+'_'+_0x1b9155[_0xd46e('0xd1')],'name':_0x1b9155['DisplayName'][_0xd46e('0xcf')]?_0x1b9155[_0xd46e('0xd2')][_0xd46e('0xcf')]['Label']:_0x1b9155[_0xd46e('0xd1')],'custom':![],'options':[]};_0x5d25f7[_0xd46e('0xc6')](_0x283798);return _0x5d25f7;});}
\ No newline at end of file