Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / intDynamics365Account / intDynamics365Account.controller.js
index 6ec6f96..df9e8a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x51ed=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','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~!@#$%^&-_=+[{]}.','request','then','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','Dynamics365Account','includeAll','find','create','body','findOne','getConfigurations','Subjects','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','Descriptions','getFields','ticketType','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','regardingobjectid','directioncode','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','resolveby','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','slice','substring','lastIndexOf','format','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','FalseOption','false','LogicalName','?$select=DisplayName,LogicalName','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x3ef41e,_0x591168){var _0x339367=function(_0xd89dab){while(--_0xd89dab){_0x3ef41e['push'](_0x3ef41e['shift']());}};_0x339367(++_0x591168);}(_0x51ed,0x1a3));var _0xd51e=function(_0x31784e,_0x38448f){_0x31784e=_0x31784e-0x0;var _0x5f1d91=_0x51ed[_0x31784e];return _0x5f1d91;};'use strict';var pdf=require(_0xd51e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd51e('0x1'));var zipdir=require(_0xd51e('0x2'));var jsonpatch=require(_0xd51e('0x3'));var rp=require(_0xd51e('0x4'));var moment=require(_0xd51e('0x5'));var BPromise=require(_0xd51e('0x6'));var Mustache=require('mustache');var util=require(_0xd51e('0x7'));var path=require(_0xd51e('0x8'));var sox=require(_0xd51e('0x9'));var csv=require(_0xd51e('0xa'));var ejs=require(_0xd51e('0xb'));var fs=require('fs');var _=require(_0xd51e('0xc'));var squel=require('squel');var crypto=require(_0xd51e('0xd'));var jsforce=require(_0xd51e('0xe'));var deskjs=require(_0xd51e('0xf'));var toCsv=require(_0xd51e('0xa'));var querystring=require('querystring');var Papa=require(_0xd51e('0x10'));var Redis=require(_0xd51e('0x11'));var authService=require(_0xd51e('0x12'));var qs=require(_0xd51e('0x13'));var as=require(_0xd51e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd51e('0x15'))(_0xd51e('0x16'));var utils=require(_0xd51e('0x17'));var config=require(_0xd51e('0x18'));var db=require(_0xd51e('0x19'))['db'];var integrations=require(_0xd51e('0x1a'));var jayson=require(_0xd51e('0x1b'));var client=jayson[_0xd51e('0x1c')][_0xd51e('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x48b06b,_0x2bc8a8,_0x243a5c){if(_0x243a5c){var _0x279d82=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x279d82[_0xd51e('0x1e')](_0x2bc8a8)){return _0x48b06b;}else{throw new db[(_0xd51e('0x1f'))][(_0xd51e('0x20'))](_0xd51e('0x21'));}}else{return _0x48b06b;}}function respondWithRpcPromise(_0x2533d9,_0x2347db,_0x19bc65,_0x391e11){return new BPromise(function(_0x27bb2a,_0x27a12a){var _0x4a94d7=_0x391e11||client;return _0x4a94d7[_0xd51e('0x22')](_0x2533d9,_0x19bc65)[_0xd51e('0x23')](function(_0x1fb512){logger['info'](_0xd51e('0x24'),_0x2347db,'request\x20sent');logger[_0xd51e('0x25')](_0xd51e('0x26'),_0x2347db,_0xd51e('0x27'),JSON[_0xd51e('0x28')](_0x1fb512));if(_0x1fb512[_0xd51e('0x29')]){if(_0x1fb512['error'][_0xd51e('0x2a')]===0x1f4){logger['error'](_0xd51e('0x24'),_0x2347db,_0x1fb512[_0xd51e('0x29')]['message']);return _0x27a12a(_0x1fb512[_0xd51e('0x29')][_0xd51e('0x2b')]);}logger[_0xd51e('0x29')](_0xd51e('0x24'),_0x2347db,_0x1fb512[_0xd51e('0x29')][_0xd51e('0x2b')]);return _0x27bb2a(_0x1fb512['error'][_0xd51e('0x2b')]);}else{logger[_0xd51e('0x2c')](_0xd51e('0x24'),_0x2347db,_0xd51e('0x27'));_0x27bb2a(_0x1fb512[_0xd51e('0x2d')][_0xd51e('0x2b')]);}})['catch'](function(_0x50b6ac){logger['error'](_0xd51e('0x24'),_0x2347db,_0x50b6ac);_0x27a12a(_0x50b6ac);});});}function respondWithStatusCode(_0x26a8da,_0x76d714){_0x76d714=_0x76d714||0xcc;return function(_0x1de90d){if(_0x1de90d){return _0x26a8da[_0xd51e('0x2e')](_0x76d714);}return _0x26a8da[_0xd51e('0x2f')](_0x76d714)[_0xd51e('0x30')]();};}function respondWithResult(_0x5e4b7d,_0x430291){_0x430291=_0x430291||0xc8;return function(_0x4a2b9f){if(_0x4a2b9f){return _0x5e4b7d['status'](_0x430291)[_0xd51e('0x31')](_0x4a2b9f);}};}function respondWithFilteredResult(_0x5159ad,_0x14c1fd){return function(_0x477f6c){if(_0x477f6c){var _0x54af44=_0x477f6c[_0xd51e('0x32')],_0x4fae56=_0x14c1fd['offset'],_0x101a31=_0x14c1fd[_0xd51e('0x33')]+_0x14c1fd[_0xd51e('0x34')],_0x5e8a38;if(_0x101a31>=_0x54af44){_0x101a31=_0x54af44;_0x5e8a38=0xc8;}else{_0x5e8a38=0xce;}_0x5159ad[_0xd51e('0x2f')](_0x5e8a38);return _0x5159ad[_0xd51e('0x35')](_0xd51e('0x36'),_0x4fae56+'-'+_0x101a31+'/'+_0x54af44)[_0xd51e('0x31')](_0x477f6c);}return null;};}function patchUpdates(_0x5741bc){return function(_0x2ba88e){try{jsonpatch[_0xd51e('0x37')](_0x2ba88e,_0x5741bc,!![]);}catch(_0x1a4b35){return BPromise[_0xd51e('0x38')](_0x1a4b35);}return _0x2ba88e[_0xd51e('0x39')]();};}function saveUpdates(_0x11cdf1,_0x4d64ed){return function(_0x350290){if(_0x350290){return _0x350290[_0xd51e('0x3a')](_0x11cdf1)['then'](function(_0x13828d){return _0x13828d;});}return null;};}function removeEntity(_0xbdebef,_0x4a40ff){return function(_0x3d8f5a){if(_0x3d8f5a){return _0x3d8f5a[_0xd51e('0x3b')]()[_0xd51e('0x23')](function(){_0xbdebef[_0xd51e('0x2f')](0xcc)[_0xd51e('0x30')]();});}};}function handleEntityNotFound(_0x5a3c87,_0x160afd){return function(_0x2b4b90){if(!_0x2b4b90){_0x5a3c87[_0xd51e('0x2e')](0x194);}return _0x2b4b90;};}function handleError(_0x15e619,_0x2ca9c7){_0x2ca9c7=_0x2ca9c7||0x1f4;return function(_0x3ca507){logger[_0xd51e('0x29')](_0x3ca507[_0xd51e('0x3c')]);if(_0x3ca507[_0xd51e('0x3d')]){delete _0x3ca507[_0xd51e('0x3d')];}_0x15e619[_0xd51e('0x2f')](_0x2ca9c7)[_0xd51e('0x3e')](_0x3ca507);};}exports[_0xd51e('0x3f')]=function(_0x4d6aca,_0x390d3a){var _0x48a0ca={},_0x59ea0e={},_0x2f6f7d={'count':0x0,'rows':[]};var _0x15f9b6=_['map'](db['Dynamics365Account'][_0xd51e('0x40')],function(_0x3e117e){return{'name':_0x3e117e[_0xd51e('0x41')],'type':_0x3e117e[_0xd51e('0x42')][_0xd51e('0x43')]};});_0x59ea0e[_0xd51e('0x44')]=_[_0xd51e('0x45')](_0x15f9b6,'name');_0x59ea0e[_0xd51e('0x46')]=_[_0xd51e('0x47')](_0x4d6aca[_0xd51e('0x46')]);_0x59ea0e[_0xd51e('0x48')]=_[_0xd51e('0x49')](_0x59ea0e['model'],_0x59ea0e[_0xd51e('0x46')]);_0x48a0ca[_0xd51e('0x4a')]=_['intersection'](_0x59ea0e[_0xd51e('0x44')],qs[_0xd51e('0x4b')](_0x4d6aca[_0xd51e('0x46')][_0xd51e('0x4b')]));_0x48a0ca['attributes']=_0x48a0ca[_0xd51e('0x4a')][_0xd51e('0x4c')]?_0x48a0ca[_0xd51e('0x4a')]:_0x59ea0e['model'];if(!_0x4d6aca['query'][_0xd51e('0x4d')](_0xd51e('0x4e'))){_0x48a0ca[_0xd51e('0x34')]=qs[_0xd51e('0x34')](_0x4d6aca['query']['limit']);_0x48a0ca[_0xd51e('0x33')]=qs[_0xd51e('0x33')](_0x4d6aca[_0xd51e('0x46')][_0xd51e('0x33')]);}_0x48a0ca[_0xd51e('0x4f')]=qs[_0xd51e('0x50')](_0x4d6aca['query'][_0xd51e('0x50')]);_0x48a0ca[_0xd51e('0x51')]=qs['filters'](_[_0xd51e('0x52')](_0x4d6aca[_0xd51e('0x46')],_0x59ea0e['filters']),_0x15f9b6);if(_0x4d6aca['query']['filter']){_0x48a0ca[_0xd51e('0x51')]=_[_0xd51e('0x53')](_0x48a0ca[_0xd51e('0x51')],{'$or':_[_0xd51e('0x45')](_0x15f9b6,function(_0x1de19e){if(_0x1de19e[_0xd51e('0x42')]!==_0xd51e('0x54')){var _0x484607={};_0x484607[_0x1de19e['name']]={'$like':'%'+_0x4d6aca['query'][_0xd51e('0x55')]+'%'};return _0x484607;}})});}_0x48a0ca=_['merge']({},_0x48a0ca,_0x4d6aca[_0xd51e('0x56')]);var _0x4c1401={'where':_0x48a0ca[_0xd51e('0x51')]};return db['Dynamics365Account'][_0xd51e('0x32')](_0x4c1401)[_0xd51e('0x23')](function(_0x1fcee0){_0x2f6f7d['count']=_0x1fcee0;if(_0x4d6aca[_0xd51e('0x46')]['includeAll']){_0x48a0ca[_0xd51e('0x57')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xd51e('0x58')](_0x48a0ca);})['then'](function(_0x373f84){_0x2f6f7d[_0xd51e('0x59')]=_0x373f84;return _0x2f6f7d;})[_0xd51e('0x23')](respondWithFilteredResult(_0x390d3a,_0x48a0ca))[_0xd51e('0x5a')](handleError(_0x390d3a,null));};exports['show']=function(_0x6d95af,_0x18cf99){var _0x22072a={'raw':![],'where':{'id':_0x6d95af[_0xd51e('0x5b')]['id']}},_0x38b04b={};_0x38b04b[_0xd51e('0x44')]=_['keys'](db[_0xd51e('0x5c')][_0xd51e('0x40')]);_0x38b04b[_0xd51e('0x46')]=_[_0xd51e('0x47')](_0x6d95af['query']);_0x38b04b['filters']=_[_0xd51e('0x49')](_0x38b04b[_0xd51e('0x44')],_0x38b04b['query']);_0x22072a[_0xd51e('0x4a')]=_[_0xd51e('0x49')](_0x38b04b[_0xd51e('0x44')],qs[_0xd51e('0x4b')](_0x6d95af[_0xd51e('0x46')][_0xd51e('0x4b')]));_0x22072a[_0xd51e('0x4a')]=_0x22072a['attributes'][_0xd51e('0x4c')]?_0x22072a[_0xd51e('0x4a')]:_0x38b04b[_0xd51e('0x44')];if(_0x6d95af[_0xd51e('0x46')][_0xd51e('0x5d')]){_0x22072a[_0xd51e('0x57')]=[{'all':!![]}];}_0x22072a=_[_0xd51e('0x53')]({},_0x22072a,_0x6d95af['options']);return db[_0xd51e('0x5c')][_0xd51e('0x5e')](_0x22072a)[_0xd51e('0x23')](handleEntityNotFound(_0x18cf99,null))[_0xd51e('0x23')](respondWithResult(_0x18cf99,null))['catch'](handleError(_0x18cf99,null));};exports[_0xd51e('0x5f')]=function(_0x613b4b,_0x27efe7){return db['Dynamics365Account'][_0xd51e('0x5f')](_0x613b4b[_0xd51e('0x60')],{})[_0xd51e('0x23')](respondWithResult(_0x27efe7,0xc9))['catch'](handleError(_0x27efe7,null));};exports[_0xd51e('0x3a')]=function(_0x2e80ca,_0x5b1d20){if(_0x2e80ca[_0xd51e('0x60')]['id']){delete _0x2e80ca[_0xd51e('0x60')]['id'];}return db[_0xd51e('0x5c')][_0xd51e('0x5e')]({'where':{'id':_0x2e80ca[_0xd51e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5b1d20,null))['then'](saveUpdates(_0x2e80ca[_0xd51e('0x60')],null))[_0xd51e('0x23')](respondWithResult(_0x5b1d20,null))[_0xd51e('0x5a')](handleError(_0x5b1d20,null));};exports[_0xd51e('0x3b')]=function(_0x3021a9,_0x5306b6){return db[_0xd51e('0x5c')][_0xd51e('0x5e')]({'where':{'id':_0x3021a9[_0xd51e('0x5b')]['id']}})[_0xd51e('0x23')](handleEntityNotFound(_0x5306b6,null))[_0xd51e('0x23')](removeEntity(_0x5306b6,null))[_0xd51e('0x5a')](handleError(_0x5306b6,null));};exports['getConfigurations']=function(_0xaf4591,_0x1ef70c,_0x54dc71){var _0x1f5e7b={};var _0x1196ff={};var _0x1def95;var _0x3f860b;return db[_0xd51e('0x5c')][_0xd51e('0x61')]({'where':{'id':_0xaf4591[_0xd51e('0x5b')]['id']}})[_0xd51e('0x23')](handleEntityNotFound(_0x1ef70c,null))['then'](function(_0x3c123e){if(_0x3c123e){_0x1def95=_0x3c123e;_0x1196ff[_0xd51e('0x44')]=_['keys'](db['Dynamics365Configuration'][_0xd51e('0x40')]);_0x1196ff[_0xd51e('0x46')]=_[_0xd51e('0x47')](_0xaf4591[_0xd51e('0x46')]);_0x1196ff[_0xd51e('0x48')]=_[_0xd51e('0x49')](_0x1196ff[_0xd51e('0x44')],_0x1196ff[_0xd51e('0x46')]);_0x1f5e7b[_0xd51e('0x4a')]=_[_0xd51e('0x49')](_0x1196ff['model'],qs[_0xd51e('0x4b')](_0xaf4591[_0xd51e('0x46')][_0xd51e('0x4b')]));_0x1f5e7b[_0xd51e('0x4a')]=_0x1f5e7b[_0xd51e('0x4a')]['length']?_0x1f5e7b[_0xd51e('0x4a')]:_0x1196ff['model'];_0x1f5e7b[_0xd51e('0x4f')]=qs[_0xd51e('0x50')](_0xaf4591[_0xd51e('0x46')][_0xd51e('0x50')]);_0x1f5e7b[_0xd51e('0x51')]=qs['filters'](_['pick'](_0xaf4591[_0xd51e('0x46')],_0x1196ff[_0xd51e('0x48')]));if(_0xaf4591[_0xd51e('0x46')]['filter']){_0x1f5e7b['where']=_[_0xd51e('0x53')](_0x1f5e7b[_0xd51e('0x51')],{'$or':_[_0xd51e('0x45')](_0x1f5e7b[_0xd51e('0x4a')],function(_0x46b012){var _0x3533da={};_0x3533da[_0x46b012]={'$like':'%'+_0xaf4591['query']['filter']+'%'};return _0x3533da;})});}_0x1f5e7b=_['merge']({},_0x1f5e7b,_0xaf4591['options']);return _0x1def95[_0xd51e('0x62')](_0x1f5e7b);}})[_0xd51e('0x23')](function(_0x1307c9){if(_0x1307c9){_0x3f860b=_0x1307c9[_0xd51e('0x4c')];if(!_0xaf4591['query'][_0xd51e('0x4d')](_0xd51e('0x4e'))){_0x1f5e7b[_0xd51e('0x34')]=qs[_0xd51e('0x34')](_0xaf4591[_0xd51e('0x46')][_0xd51e('0x34')]);_0x1f5e7b['offset']=qs[_0xd51e('0x33')](_0xaf4591[_0xd51e('0x46')]['offset']);}return _0x1def95['getConfigurations'](_0x1f5e7b);}})[_0xd51e('0x23')](function(_0x305fdf){if(_0x305fdf){return _0x305fdf?{'count':_0x3f860b,'rows':_0x305fdf}:null;}})['then'](respondWithResult(_0x1ef70c,null))['catch'](handleError(_0x1ef70c,null));};exports['addConfiguration']=function(_0x4d80d5,_0x1d8dd0,_0x39ba8d){if(_0x4d80d5['body']['id']){delete _0x4d80d5[_0xd51e('0x60')]['id'];}return db['Dynamics365Account'][_0xd51e('0x61')]({'where':{'id':_0x4d80d5[_0xd51e('0x5b')]['id']}})[_0xd51e('0x23')](handleEntityNotFound(_0x1d8dd0,null))[_0xd51e('0x23')](function(_0x3baffa){if(_0x3baffa){_0x4d80d5[_0xd51e('0x60')]['AccountId']=_0x3baffa['id'];_0x4d80d5['body'][_0xd51e('0x63')]=integrations[_0xd51e('0x64')](_0x4d80d5[_0xd51e('0x60')][_0xd51e('0x65')],_0x4d80d5[_0xd51e('0x60')][_0xd51e('0x42')]);_0x4d80d5[_0xd51e('0x60')]['Descriptions']=integrations[_0xd51e('0x66')](_0x4d80d5[_0xd51e('0x60')][_0xd51e('0x65')],_0x4d80d5[_0xd51e('0x60')][_0xd51e('0x42')]);return db[_0xd51e('0x67')][_0xd51e('0x5f')](_0x4d80d5[_0xd51e('0x60')],{'include':[{'model':db[_0xd51e('0x68')],'as':_0xd51e('0x63')},{'model':db[_0xd51e('0x68')],'as':_0xd51e('0x69')}]});}return null;})['then'](respondWithResult(_0x1d8dd0,null))[_0xd51e('0x5a')](handleError(_0x1d8dd0,null));};exports[_0xd51e('0x6a')]=function(_0x3b27a6,_0x1d19de,_0xdf4094){var _0x26f057=_0x3b27a6['query'][_0xd51e('0x6b')];var _0x22b358=_0x26f057==='incident'?_0xd51e('0x6c'):_0xd51e('0x6d');var _0x19a53c='';var _0x2e18d6='';var _0x1dbf02='';var _0x2f1308='';var _0x2518b4='';var _0x153b58='';var _0x13e9c0='';var _0x1c2a98='';var _0x39bfb4=['title',_0xd51e('0x6e'),_0xd51e('0x6f'),_0xd51e('0x70'),_0xd51e('0x71'),'subject','phonenumber',_0xd51e('0x72'),_0xd51e('0x73'),'phonecall_activity_parties'];var _0x48e555=['accountidname','accountidyominame',_0xd51e('0x74'),_0xd51e('0x75'),_0xd51e('0x76'),'contactidyominame',_0xd51e('0x77'),'contractidname',_0xd51e('0x78'),_0xd51e('0x79'),_0xd51e('0x7a'),'createdbyyominame',_0xd51e('0x7b'),_0xd51e('0x7c'),_0xd51e('0x7d'),_0xd51e('0x7e'),_0xd51e('0x7f'),'customeridyominame',_0xd51e('0x80'),_0xd51e('0x81'),_0xd51e('0x82'),_0xd51e('0x83'),_0xd51e('0x84'),_0xd51e('0x85'),_0xd51e('0x86'),'followupby',_0xd51e('0x87'),_0xd51e('0x88'),'kbarticleidname',_0xd51e('0x89'),_0xd51e('0x8a'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname',_0xd51e('0x8b'),_0xd51e('0x8c'),_0xd51e('0x8d'),'modifiedonbehalfbyyominame',_0xd51e('0x8e'),_0xd51e('0x8f'),'numberofchildincidents',_0xd51e('0x90'),'overriddencreatedon',_0xd51e('0x91'),_0xd51e('0x92'),_0xd51e('0x93'),_0xd51e('0x94'),_0xd51e('0x95'),'primarycontactidyominame','prioritycodename',_0xd51e('0x96'),'productserialnumber',_0xd51e('0x97'),'resolvebykpiidname',_0xd51e('0x98'),_0xd51e('0x99'),'responsiblecontactidyominame',_0xd51e('0x9a'),_0xd51e('0x9b'),'slaname',_0xd51e('0x9c'),'statecode',_0xd51e('0x9d'),_0xd51e('0x9e'),'ticketnumber',_0xd51e('0x9f'),_0xd51e('0xa0'),_0xd51e('0xa1'),_0xd51e('0xa2'),_0xd51e('0xa3')];var _0x37c0c6=_0x39bfb4[_0xd51e('0xa4')](_0x48e555);return db[_0xd51e('0x5c')][_0xd51e('0x61')]({'where':{'id':_0x3b27a6[_0xd51e('0x5b')]['id']},'attributes':['id',_0xd51e('0xa5'),_0xd51e('0xa6'),_0xd51e('0xa7'),_0xd51e('0xa8'),_0xd51e('0xa9'),'clientSecret']})[_0xd51e('0x23')](handleEntityNotFound(_0x1d19de,null))[_0xd51e('0x23')](function(_0x1ba94c){if(_0x1ba94c){_0x1c2a98=_0x1ba94c['remoteUri'];var _0x40ea73=_0x1c2a98[_0xd51e('0xaa')](-0x1);if(_0x40ea73==='/'){_0x1c2a98=_0x1c2a98[_0xd51e('0xab')](0x0,_0x1c2a98[_0xd51e('0xac')](_0x40ea73));}_0x13e9c0=util[_0xd51e('0xad')]('%s/api/data/v9.0/',_0x1c2a98);var _0x6cebe6={'method':_0xd51e('0xae'),'uri':_0xd51e('0xaf')+_0x1ba94c[_0xd51e('0xa8')]+_0xd51e('0xb0'),'form':{'client_id':_0x1ba94c[_0xd51e('0xa9')],'resource':_0x1c2a98,'username':_0x1ba94c[_0xd51e('0xa5')],'password':_0x1ba94c[_0xd51e('0xa6')],'grant_type':_0xd51e('0xa6'),'client_secret':_0x1ba94c['clientSecret']},'json':!![]};return rp(_0x6cebe6);}})[_0xd51e('0x23')](function(_0x41be87){_0x153b58=_0x41be87[_0xd51e('0xb1')];var _0x2d4750={'method':_0xd51e('0xb2'),'uri':encodeURI(_0x13e9c0+_0xd51e('0xb3')+_0x22b358+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x153b58,'If-None-Match':null,'OData-Version':_0xd51e('0xb4')},'json':!![]};return rp(_0x2d4750);})['then'](function(_0x22b08a){var _0x21fcd3=_0x22b08a[_0xd51e('0xb5')][0x0];var _0x3a9366=_0x21fcd3['MetadataId'];var _0x1c4ade={'method':_0xd51e('0xb2'),'uri':_0x13e9c0+_0xd51e('0xb6')+_0x3a9366+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xd51e('0xb7')+_0x153b58,'If-None-Match':null,'OData-Version':_0xd51e('0xb4')},'json':!![]};return rp(_0x1c4ade);})[_0xd51e('0x23')](function(_0x49bfa2){_0x19a53c=_0x49bfa2;_0x2e18d6=_0x19a53c[_0xd51e('0xb8')];_0x2e18d6=_[_0xd51e('0xb9')](_0x2e18d6,function(_0x4abb14){return!_0x37c0c6[_0xd51e('0xba')](_0x4abb14['LogicalName']);});var _0x2731bf=[];var _0x3a7123=[];_0x2e18d6[_0xd51e('0xbb')](function(_0x4da9eb){if(_0x4da9eb[_0xd51e('0xbc')]){var _0x49b15c=_0x4da9eb[_0xd51e('0xbc')][_0xd51e('0xab')](_0x4da9eb[_0xd51e('0xbc')][_0xd51e('0xac')]('.')+0x1);if(_0x49b15c===_0xd51e('0xbd')){_0x2731bf[_0xd51e('0xbe')](getSelectList(_0x13e9c0,_0x26f057,_0x3a7123,_0x19a53c[_0xd51e('0xbf')],_0x4da9eb['MetadataId'],_0x153b58));}}});return Promise[_0xd51e('0xc0')](_0x2731bf);})[_0xd51e('0x23')](function(_0xe4272f){_0x1dbf02=_0xe4272f[0x0];var _0x5df4c1=[];var _0x12bf05=[];_0x2e18d6[_0xd51e('0xbb')](function(_0xd092f8){if(!_[_0xd51e('0xc1')](_0xd092f8[_0xd51e('0xbc')])){var _0x2b2a5a=_0xd092f8[_0xd51e('0xbc')][_0xd51e('0xab')](_0xd092f8[_0xd51e('0xbc')][_0xd51e('0xac')]('.')+0x1);if(_0x2b2a5a===_0xd51e('0xc2')){_0x5df4c1['push'](getBooleanList(_0x13e9c0,_0x26f057,_0x12bf05,_0x19a53c[_0xd51e('0xbf')],_0xd092f8[_0xd51e('0xbf')],_0x153b58));}}});return Promise[_0xd51e('0xc0')](_0x5df4c1);})[_0xd51e('0x23')](function(_0x221021){_0x2f1308=_0x221021[0x0];var _0x82dbc8=[];var _0x2e48d1=[];_0x2e18d6[_0xd51e('0xbb')](function(_0x489a12){if(_0x489a12[_0xd51e('0xbc')]){var _0x1819fe=_0x489a12[_0xd51e('0xbc')][_0xd51e('0xab')](_0x489a12['@odata.type'][_0xd51e('0xac')]('.')+0x1);if(_0x1819fe===_0xd51e('0xc3')||_0x1819fe===_0xd51e('0xc4')||_0x1819fe==='BigIntAttributeMetadata'||_0x1819fe==='IntegerAttributeMetadata'||_0x1819fe===_0xd51e('0xc5')||_0x1819fe===_0xd51e('0xc6')||_0x1819fe===_0xd51e('0xc7')||_0x1819fe==='EntityNameAttributeMetadata'||_0x1819fe===_0xd51e('0xc8')||_0x1819fe===_0xd51e('0xc9')){_0x82dbc8['push'](getInputList(_0x13e9c0,_0x26f057,_0x1819fe,_0x2e48d1,_0x19a53c[_0xd51e('0xbf')],_0x489a12[_0xd51e('0xbf')],_0x153b58));}}});return Promise['all'](_0x82dbc8);})['then'](function(_0xd6e286){_0x2518b4=_0xd6e286[0x0];var _0xded614=_0x1dbf02['concat'](_0x2f1308)[_0xd51e('0xa4')](_0x2518b4);var _0x340fd2={'count':_0xded614['length'],'rows':_0xded614};return _0x340fd2;})[_0xd51e('0x23')](respondWithResult(_0x1d19de,null))['catch'](function(_0x1e4280){var _0x4708ff=_0x3b27a6[_0xd51e('0x46')][_0xd51e('0x1e')]?0x1f4:_0x1e4280[_0xd51e('0xca')]||0x1f4;logger[_0xd51e('0x29')](_0x1e4280[_0xd51e('0x3c')]);delete _0x1e4280['name'];if(_0x4708ff===0x191){_0x4708ff=0x190;}_0x1d19de[_0xd51e('0x2f')](_0x4708ff)['send'](_0x3b27a6['query'][_0xd51e('0x1e')]?{'message':_0xd51e('0xcb'),'statusCode':_0x1e4280['statusCode']}:_0x1e4280);});};function getSelectList(_0x465623,_0x23c278,_0x20fcf5,_0x5759fd,_0x49d4c5,_0x2d95a2){var _0x1c1d91={'method':_0xd51e('0xb2'),'uri':_0x465623+_0xd51e('0xb6')+_0x5759fd+_0xd51e('0xcc')+_0x49d4c5+_0xd51e('0xcd')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xd51e('0xb7')+_0x2d95a2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c1d91)[_0xd51e('0x23')](function(_0x5b6fd8){var _0x30b9be=[];var _0x153bc0=_0x5b6fd8[_0xd51e('0xce')][_0xd51e('0xcf')];_0x153bc0[_0xd51e('0xbb')](function(_0x194f67){_0x30b9be[_0xd51e('0xbe')]({'name':_0x194f67[_0xd51e('0xd0')][_0xd51e('0xd1')]['Label'],'value':String(_0x194f67[_0xd51e('0xd2')])});});var _0x1df151={'id':_0x23c278+'_'+_0x5b6fd8['LogicalName'],'name':_0x5b6fd8[_0xd51e('0xd3')][_0xd51e('0xd1')]['Label'],'custom':![],'options':_0x30b9be};_0x20fcf5[_0xd51e('0xbe')](_0x1df151);return _0x20fcf5;});}function getBooleanList(_0x3b97da,_0x44c780,_0x5d834e,_0xf69405,_0x3ed854,_0x267dde){var _0x34a81a={'method':_0xd51e('0xb2'),'uri':_0x3b97da+_0xd51e('0xb6')+_0xf69405+')/Attributes('+_0x3ed854+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xd51e('0xb7')+_0x267dde,'If-None-Match':null,'OData-Version':_0xd51e('0xb4')},'json':!![]};return rp(_0x34a81a)[_0xd51e('0x23')](function(_0x4bd3e2){var _0x15ff3d=[];_0x15ff3d[_0xd51e('0xbe')]({'name':_0x4bd3e2[_0xd51e('0xce')]['TrueOption'][_0xd51e('0xd0')][_0xd51e('0xd1')][_0xd51e('0xd0')],'value':'true'},{'name':_0x4bd3e2['OptionSet'][_0xd51e('0xd4')]['Label'][_0xd51e('0xd1')][_0xd51e('0xd0')],'value':_0xd51e('0xd5')});var _0xb1d1d={'id':_0x44c780+'_'+_0x4bd3e2[_0xd51e('0xd6')],'name':_0x4bd3e2['DisplayName'][_0xd51e('0xd1')][_0xd51e('0xd0')],'custom':![],'options':_0x15ff3d};_0x5d834e[_0xd51e('0xbe')](_0xb1d1d);return _0x5d834e;});}function getInputList(_0x59265a,_0xaf6aaa,_0x199165,_0x33c060,_0x83abed,_0x1cc7ae,_0x2739e9){var _0xacdf7c={'method':_0xd51e('0xb2'),'uri':_0x59265a+_0xd51e('0xb6')+_0x83abed+_0xd51e('0xcc')+_0x1cc7ae+')/Microsoft.Dynamics.CRM.'+_0x199165+_0xd51e('0xd7'),'headers':{'Authorization':_0xd51e('0xb7')+_0x2739e9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xacdf7c)[_0xd51e('0x23')](function(_0x4ee8ce){var _0x286195={'id':_0xaf6aaa+'_'+_0x4ee8ce[_0xd51e('0xd6')],'name':_0x4ee8ce[_0xd51e('0xd3')]['UserLocalizedLabel']?_0x4ee8ce['DisplayName']['UserLocalizedLabel'][_0xd51e('0xd0')]:_0x4ee8ce[_0xd51e('0xd6')],'custom':![],'options':[]};_0x33c060[_0xd51e('0xbe')](_0x286195);return _0x33c060;});}
\ No newline at end of file
+var _0x0fc6=['UserLocalizedLabel','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','status','offset','undefined','limit','count','set','update','then','destroy','end','sendStatus','error','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filter','where','merge','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyyominame','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slaname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','modernAuthentication','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','forEach','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','all','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Bearer\x20','OptionSet','Options','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption'];(function(_0x2141e1,_0x523aff){var _0x59db37=function(_0x1ffc7c){while(--_0x1ffc7c){_0x2141e1['push'](_0x2141e1['shift']());}};_0x59db37(++_0x523aff);}(_0x0fc6,0x176));var _0x60fc=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0fc6[_0x42cae2];return _0x5f256f;};'use strict';var rp=require(_0x60fc('0x0'));var util=require(_0x60fc('0x1'));var _=require(_0x60fc('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x60fc('0x3'))(_0x60fc('0x4'));var db=require(_0x60fc('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x322322,_0x4eaa25){_0x4eaa25=_0x4eaa25||0xc8;return function(_0x23c1d7){if(_0x23c1d7){return _0x322322[_0x60fc('0x6')](_0x4eaa25)['json'](_0x23c1d7);}};}function respondWithFilteredResult(_0x3491cc,_0x823732){return function(_0x2b5923){if(_0x2b5923){var _0x1cf074=typeof _0x823732[_0x60fc('0x7')]===_0x60fc('0x8')&&typeof _0x823732[_0x60fc('0x9')]==='undefined';var _0x1de3a6=_0x2b5923[_0x60fc('0xa')];var _0x396740=_0x1cf074?0x0:_0x823732[_0x60fc('0x7')];var _0x5a7536=_0x1cf074?_0x2b5923[_0x60fc('0xa')]:_0x823732[_0x60fc('0x7')]+_0x823732['limit'];var _0x11d555;if(_0x5a7536>=_0x1de3a6){_0x5a7536=_0x1de3a6;_0x11d555=0xc8;}else{_0x11d555=0xce;}_0x3491cc[_0x60fc('0x6')](_0x11d555);return _0x3491cc[_0x60fc('0xb')]('Content-Range',_0x396740+'-'+_0x5a7536+'/'+_0x1de3a6)['json'](_0x2b5923);}return null;};}function saveUpdates(_0xb6d714){return function(_0x2c836a){if(_0x2c836a){return _0x2c836a[_0x60fc('0xc')](_0xb6d714)[_0x60fc('0xd')](function(_0x175070){return _0x175070;});}return null;};}function removeEntity(_0x58ef07){return function(_0x435f22){if(_0x435f22){return _0x435f22[_0x60fc('0xe')]()[_0x60fc('0xd')](function(){_0x58ef07[_0x60fc('0x6')](0xcc)[_0x60fc('0xf')]();});}};}function handleEntityNotFound(_0xc75a8c){return function(_0x4e9bf6){if(!_0x4e9bf6){_0xc75a8c[_0x60fc('0x10')](0x194);}return _0x4e9bf6;};}function handleError(_0x3816e2,_0x522902){_0x522902=_0x522902||0x1f4;return function(_0x4d76c2){logger[_0x60fc('0x11')](_0x4d76c2['stack']);if(_0x4d76c2['name']){delete _0x4d76c2[_0x60fc('0x12')];}_0x3816e2[_0x60fc('0x6')](_0x522902)[_0x60fc('0x13')](_0x4d76c2);};}exports[_0x60fc('0x14')]=function(_0x4f236f,_0x307e51){var _0x25e5e8={},_0x27ab90={},_0x37f09d={'count':0x0,'rows':[]};var _0x4a9b8e=_[_0x60fc('0x15')](db[_0x60fc('0x16')][_0x60fc('0x17')],function(_0x2284b0){return{'name':_0x2284b0[_0x60fc('0x18')],'type':_0x2284b0[_0x60fc('0x19')]['key']};});_0x27ab90['model']=_[_0x60fc('0x15')](_0x4a9b8e,_0x60fc('0x12'));_0x27ab90[_0x60fc('0x1a')]=_[_0x60fc('0x1b')](_0x4f236f[_0x60fc('0x1a')]);_0x27ab90[_0x60fc('0x1c')]=_[_0x60fc('0x1d')](_0x27ab90['model'],_0x27ab90[_0x60fc('0x1a')]);_0x25e5e8[_0x60fc('0x1e')]=_['intersection'](_0x27ab90[_0x60fc('0x1f')],qs[_0x60fc('0x20')](_0x4f236f['query']['fields']));_0x25e5e8[_0x60fc('0x1e')]=_0x25e5e8[_0x60fc('0x1e')][_0x60fc('0x21')]?_0x25e5e8[_0x60fc('0x1e')]:_0x27ab90[_0x60fc('0x1f')];if(!_0x4f236f[_0x60fc('0x1a')][_0x60fc('0x22')]('nolimit')){_0x25e5e8[_0x60fc('0x9')]=qs[_0x60fc('0x9')](_0x4f236f[_0x60fc('0x1a')][_0x60fc('0x9')]);_0x25e5e8[_0x60fc('0x7')]=qs[_0x60fc('0x7')](_0x4f236f[_0x60fc('0x1a')]['offset']);}_0x25e5e8[_0x60fc('0x23')]=qs[_0x60fc('0x24')](_0x4f236f[_0x60fc('0x1a')][_0x60fc('0x24')]);_0x25e5e8['where']=qs[_0x60fc('0x1c')](_['pick'](_0x4f236f[_0x60fc('0x1a')],_0x27ab90['filters']),_0x4a9b8e);if(_0x4f236f['query'][_0x60fc('0x25')]){_0x25e5e8[_0x60fc('0x26')]=_[_0x60fc('0x27')](_0x25e5e8['where'],{'$or':_[_0x60fc('0x15')](_0x4a9b8e,function(_0xdc3bc5){if(_0xdc3bc5[_0x60fc('0x19')]!=='VIRTUAL'){var _0x59dfd1={};_0x59dfd1[_0xdc3bc5[_0x60fc('0x12')]]={'$like':'%'+_0x4f236f[_0x60fc('0x1a')][_0x60fc('0x25')]+'%'};return _0x59dfd1;}})});}_0x25e5e8=_['merge']({},_0x25e5e8,_0x4f236f['options']);var _0x2fc68e={'where':_0x25e5e8[_0x60fc('0x26')]};return db[_0x60fc('0x16')][_0x60fc('0xa')](_0x2fc68e)[_0x60fc('0xd')](function(_0x5d30ab){_0x37f09d[_0x60fc('0xa')]=_0x5d30ab;if(_0x4f236f[_0x60fc('0x1a')][_0x60fc('0x28')]){_0x25e5e8[_0x60fc('0x29')]=[{'all':!![]}];}return db[_0x60fc('0x16')]['findAll'](_0x25e5e8);})[_0x60fc('0xd')](function(_0x3cb6ec){_0x37f09d[_0x60fc('0x2a')]=_0x3cb6ec;return _0x37f09d;})[_0x60fc('0xd')](respondWithFilteredResult(_0x307e51,_0x25e5e8))[_0x60fc('0x2b')](handleError(_0x307e51,null));};exports[_0x60fc('0x2c')]=function(_0x363a02,_0x70f9ce){var _0x43e1f8={'raw':![],'where':{'id':_0x363a02[_0x60fc('0x2d')]['id']}},_0x152e3={};_0x152e3[_0x60fc('0x1f')]=_['keys'](db[_0x60fc('0x16')][_0x60fc('0x17')]);_0x152e3[_0x60fc('0x1a')]=_[_0x60fc('0x1b')](_0x363a02[_0x60fc('0x1a')]);_0x152e3[_0x60fc('0x1c')]=_[_0x60fc('0x1d')](_0x152e3[_0x60fc('0x1f')],_0x152e3[_0x60fc('0x1a')]);_0x43e1f8[_0x60fc('0x1e')]=_[_0x60fc('0x1d')](_0x152e3[_0x60fc('0x1f')],qs['fields'](_0x363a02[_0x60fc('0x1a')][_0x60fc('0x20')]));_0x43e1f8['attributes']=_0x43e1f8[_0x60fc('0x1e')]['length']?_0x43e1f8[_0x60fc('0x1e')]:_0x152e3[_0x60fc('0x1f')];if(_0x363a02[_0x60fc('0x1a')][_0x60fc('0x28')]){_0x43e1f8[_0x60fc('0x29')]=[{'all':!![]}];}_0x43e1f8=_['merge']({},_0x43e1f8,_0x363a02['options']);return db[_0x60fc('0x16')][_0x60fc('0x2e')](_0x43e1f8)[_0x60fc('0xd')](handleEntityNotFound(_0x70f9ce,null))['then'](respondWithResult(_0x70f9ce,null))['catch'](handleError(_0x70f9ce,null));};exports[_0x60fc('0x2f')]=function(_0x45cc96,_0x1693dd){return db['Dynamics365Account'][_0x60fc('0x2f')](_0x45cc96[_0x60fc('0x30')],{})[_0x60fc('0xd')](respondWithResult(_0x1693dd,0xc9))['catch'](handleError(_0x1693dd,null));};exports['update']=function(_0x4aa923,_0x2474de){if(_0x4aa923[_0x60fc('0x30')]['id']){delete _0x4aa923['body']['id'];}return db[_0x60fc('0x16')][_0x60fc('0x2e')]({'where':{'id':_0x4aa923[_0x60fc('0x2d')]['id']}})[_0x60fc('0xd')](handleEntityNotFound(_0x2474de,null))[_0x60fc('0xd')](saveUpdates(_0x4aa923[_0x60fc('0x30')],null))[_0x60fc('0xd')](respondWithResult(_0x2474de,null))[_0x60fc('0x2b')](handleError(_0x2474de,null));};exports[_0x60fc('0xe')]=function(_0x8b8f6a,_0x524e17){return db[_0x60fc('0x16')]['find']({'where':{'id':_0x8b8f6a[_0x60fc('0x2d')]['id']}})['then'](handleEntityNotFound(_0x524e17,null))[_0x60fc('0xd')](removeEntity(_0x524e17,null))[_0x60fc('0x2b')](handleError(_0x524e17,null));};exports[_0x60fc('0x31')]=function(_0x24ec45,_0x58af1d){var _0x1dd032={};var _0x5b6a9c={};var _0xeee94d;var _0x5becaf;return db[_0x60fc('0x16')][_0x60fc('0x32')]({'where':{'id':_0x24ec45['params']['id']}})['then'](handleEntityNotFound(_0x58af1d,null))[_0x60fc('0xd')](function(_0x4669e3){if(_0x4669e3){_0xeee94d=_0x4669e3;_0x5b6a9c['model']=_[_0x60fc('0x1b')](db[_0x60fc('0x33')][_0x60fc('0x17')]);_0x5b6a9c[_0x60fc('0x1a')]=_[_0x60fc('0x1b')](_0x24ec45[_0x60fc('0x1a')]);_0x5b6a9c[_0x60fc('0x1c')]=_['intersection'](_0x5b6a9c[_0x60fc('0x1f')],_0x5b6a9c[_0x60fc('0x1a')]);_0x1dd032[_0x60fc('0x1e')]=_[_0x60fc('0x1d')](_0x5b6a9c[_0x60fc('0x1f')],qs[_0x60fc('0x20')](_0x24ec45[_0x60fc('0x1a')][_0x60fc('0x20')]));_0x1dd032[_0x60fc('0x1e')]=_0x1dd032[_0x60fc('0x1e')][_0x60fc('0x21')]?_0x1dd032[_0x60fc('0x1e')]:_0x5b6a9c['model'];_0x1dd032['order']=qs[_0x60fc('0x24')](_0x24ec45['query'][_0x60fc('0x24')]);_0x1dd032[_0x60fc('0x26')]=qs['filters'](_['pick'](_0x24ec45[_0x60fc('0x1a')],_0x5b6a9c['filters']));if(_0x24ec45[_0x60fc('0x1a')][_0x60fc('0x25')]){_0x1dd032[_0x60fc('0x26')]=_[_0x60fc('0x27')](_0x1dd032[_0x60fc('0x26')],{'$or':_[_0x60fc('0x15')](_0x1dd032['attributes'],function(_0x16c692){var _0x8fbd06={};_0x8fbd06[_0x16c692]={'$like':'%'+_0x24ec45['query'][_0x60fc('0x25')]+'%'};return _0x8fbd06;})});}_0x1dd032=_['merge']({},_0x1dd032,_0x24ec45['options']);return _0xeee94d[_0x60fc('0x31')](_0x1dd032);}})[_0x60fc('0xd')](function(_0x1f59fa){if(_0x1f59fa){_0x5becaf=_0x1f59fa['length'];if(!_0x24ec45[_0x60fc('0x1a')][_0x60fc('0x22')]('nolimit')){_0x1dd032[_0x60fc('0x9')]=qs['limit'](_0x24ec45[_0x60fc('0x1a')][_0x60fc('0x9')]);_0x1dd032[_0x60fc('0x7')]=qs[_0x60fc('0x7')](_0x24ec45[_0x60fc('0x1a')][_0x60fc('0x7')]);}return _0xeee94d[_0x60fc('0x31')](_0x1dd032);}})[_0x60fc('0xd')](function(_0xdcf72a){if(_0xdcf72a){return _0xdcf72a?{'count':_0x5becaf,'rows':_0xdcf72a}:null;}})[_0x60fc('0xd')](respondWithResult(_0x58af1d,null))[_0x60fc('0x2b')](handleError(_0x58af1d,null));};exports[_0x60fc('0x34')]=function(_0x56cba8,_0xed6430){if(_0x56cba8[_0x60fc('0x30')]['id']){delete _0x56cba8['body']['id'];}return db[_0x60fc('0x16')][_0x60fc('0x32')]({'where':{'id':_0x56cba8[_0x60fc('0x2d')]['id']}})[_0x60fc('0xd')](handleEntityNotFound(_0xed6430,null))['then'](function(_0x2323f0){if(_0x2323f0){_0x56cba8[_0x60fc('0x30')][_0x60fc('0x35')]=_0x2323f0['id'];_0x56cba8[_0x60fc('0x30')][_0x60fc('0x36')]=integrations[_0x60fc('0x37')](_0x56cba8[_0x60fc('0x30')][_0x60fc('0x38')],_0x56cba8[_0x60fc('0x30')][_0x60fc('0x19')]);_0x56cba8[_0x60fc('0x30')]['Descriptions']=integrations[_0x60fc('0x39')](_0x56cba8[_0x60fc('0x30')][_0x60fc('0x38')],_0x56cba8['body']['type']);return db[_0x60fc('0x33')][_0x60fc('0x2f')](_0x56cba8[_0x60fc('0x30')],{'include':[{'model':db[_0x60fc('0x3a')],'as':_0x60fc('0x36')},{'model':db[_0x60fc('0x3a')],'as':_0x60fc('0x3b')}]});}return null;})[_0x60fc('0xd')](respondWithResult(_0xed6430,null))['catch'](handleError(_0xed6430,null));};function sanitizeRemoteUri(_0x2da367){var _0x190694=_0x2da367[_0x60fc('0x3c')](-0x1);if(_0x190694==='/')return _0x2da367[_0x60fc('0x3d')](0x0,_0x2da367[_0x60fc('0x3e')](_0x190694));return _0x2da367;}function getWebApiUrl(_0x22ac78){return util[_0x60fc('0x3f')](_0x60fc('0x40'),_0x22ac78);}exports[_0x60fc('0x41')]=function(_0x89db9c,_0x3389d0){var _0x247dac=_0x89db9c[_0x60fc('0x1a')][_0x60fc('0x42')];var _0x3af3ea=_0x247dac===_0x60fc('0x43')?_0x60fc('0x44'):_0x60fc('0x45');var _0x5a24fa='';var _0x3c9492='';var _0x22292f='';var _0x405c9b='';var _0x258afe='';var _0x5a2a01='';var _0x197687='';var _0x146423='';var _0x381fee=['title',_0x60fc('0x46'),'customerid',_0x60fc('0x47'),_0x60fc('0x48'),'subject',_0x60fc('0x49'),_0x60fc('0x4a'),_0x60fc('0x4b'),_0x60fc('0x4c')];var _0x145986=[_0x60fc('0x4d'),_0x60fc('0x4e'),_0x60fc('0x4f'),_0x60fc('0x50'),_0x60fc('0x51'),_0x60fc('0x52'),'contractdetailidname',_0x60fc('0x53'),_0x60fc('0x54'),'createdbyexternalpartyyominame',_0x60fc('0x55'),'createdbyyominame',_0x60fc('0x56'),'createdonbehalfbyname',_0x60fc('0x57'),'customeridname','customeridtype',_0x60fc('0x58'),'emailaddress',_0x60fc('0x59'),_0x60fc('0x5a'),_0x60fc('0x5b'),_0x60fc('0x5c'),_0x60fc('0x5d'),_0x60fc('0x5e'),_0x60fc('0x5f'),_0x60fc('0x60'),_0x60fc('0x61'),_0x60fc('0x62'),_0x60fc('0x63'),_0x60fc('0x64'),_0x60fc('0x65'),_0x60fc('0x66'),'modifiedbyname',_0x60fc('0x67'),_0x60fc('0x68'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x60fc('0x69'),_0x60fc('0x6a'),_0x60fc('0x6b'),_0x60fc('0x6c'),'overriddencreatedon','owneridname','owneridtype',_0x60fc('0x6d'),_0x60fc('0x6e'),_0x60fc('0x6f'),_0x60fc('0x70'),'prioritycodename','productidname','productserialnumber',_0x60fc('0x71'),_0x60fc('0x72'),_0x60fc('0x73'),_0x60fc('0x74'),_0x60fc('0x75'),'sentimentvalue','slainvokedidname',_0x60fc('0x76'),'socialprofileidname','statecode','statuscode','subjectidname',_0x60fc('0x77'),_0x60fc('0x78'),_0x60fc('0x79'),_0x60fc('0x7a'),_0x60fc('0x7b'),_0x60fc('0x7c')];var _0x17926f=_0x381fee[_0x60fc('0x7d')](_0x145986);return db[_0x60fc('0x16')][_0x60fc('0x32')]({'where':{'id':_0x89db9c['params']['id']},'attributes':['id',_0x60fc('0x7e'),'password',_0x60fc('0x7f'),_0x60fc('0x80'),_0x60fc('0x81'),_0x60fc('0x82'),'modernAuthentication'],'include':[{'model':db[_0x60fc('0x83')],'as':_0x60fc('0x83'),'attributes':['id',_0x60fc('0x84'),'data7']}]})[_0x60fc('0xd')](handleEntityNotFound(_0x3389d0,null))[_0x60fc('0xd')](function(_0x3e25fd){if(_0x3e25fd){if(_0x3e25fd[_0x60fc('0x85')]){_0x3e25fd[_0x60fc('0x86')]=_0x3e25fd['CloudProvider'][_0x60fc('0x84')];_0x146423=sanitizeRemoteUri(_0x3e25fd[_0x60fc('0x83')][_0x60fc('0x87')]);_0x197687=getWebApiUrl(_0x146423);return _0x3e25fd;}_0x146423=sanitizeRemoteUri(_0x3e25fd[_0x60fc('0x7f')]);_0x197687=getWebApiUrl(_0x146423);var _0x5a6ed4={'method':_0x60fc('0x88'),'uri':_0x60fc('0x89')+_0x3e25fd[_0x60fc('0x80')]+_0x60fc('0x8a'),'form':{'client_id':_0x3e25fd['clientId'],'resource':_0x146423,'username':_0x3e25fd['username'],'password':_0x3e25fd['password'],'grant_type':'password','client_secret':_0x3e25fd[_0x60fc('0x82')]},'json':!![]};return rp(_0x5a6ed4);}})[_0x60fc('0xd')](function(_0x49342a){_0x5a2a01=_0x49342a[_0x60fc('0x86')];var _0x1a68fd={'method':_0x60fc('0x8b'),'uri':encodeURI(_0x197687+_0x60fc('0x8c')+_0x3af3ea+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x5a2a01,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1a68fd);})[_0x60fc('0xd')](function(_0x1f5740){var _0x89c4ed=_0x1f5740[_0x60fc('0x8d')][0x0];var _0x15fa99=_0x89c4ed['MetadataId'];var _0x18fee4={'method':_0x60fc('0x8b'),'uri':_0x197687+_0x60fc('0x8e')+_0x15fa99+_0x60fc('0x8f'),'headers':{'Authorization':'Bearer\x20'+_0x5a2a01,'If-None-Match':null,'OData-Version':_0x60fc('0x90')},'json':!![]};return rp(_0x18fee4);})['then'](function(_0x4669cb){_0x5a24fa=_0x4669cb;_0x3c9492=_0x5a24fa['Attributes'];_0x3c9492=_[_0x60fc('0x91')](_0x3c9492,function(_0x29c16a){return!_0x17926f[_0x60fc('0x92')](_0x29c16a[_0x60fc('0x93')]);});var _0x558069=[];var _0x12eb0c=[];_0x3c9492['forEach'](function(_0x5b2313){if(_0x5b2313[_0x60fc('0x94')]){var _0x1fc26d=_0x5b2313[_0x60fc('0x94')][_0x60fc('0x3d')](_0x5b2313[_0x60fc('0x94')][_0x60fc('0x3e')]('.')+0x1);if(_0x1fc26d===_0x60fc('0x95')){_0x558069[_0x60fc('0x96')](getSelectList(_0x197687,_0x247dac,_0x12eb0c,_0x5a24fa[_0x60fc('0x97')],_0x5b2313[_0x60fc('0x97')],_0x5a2a01));}}});return Promise['all'](_0x558069);})[_0x60fc('0xd')](function(_0x48cb52){_0x22292f=_0x48cb52[0x0];var _0x55f150=[];var _0x4a71bc=[];_0x3c9492[_0x60fc('0x98')](function(_0xe429b7){if(!_['isNil'](_0xe429b7[_0x60fc('0x94')])){var _0x3c9973=_0xe429b7[_0x60fc('0x94')]['substring'](_0xe429b7['@odata.type'][_0x60fc('0x3e')]('.')+0x1);if(_0x3c9973===_0x60fc('0x99')){_0x55f150[_0x60fc('0x96')](getBooleanList(_0x197687,_0x247dac,_0x4a71bc,_0x5a24fa['MetadataId'],_0xe429b7['MetadataId'],_0x5a2a01));}}});return Promise['all'](_0x55f150);})[_0x60fc('0xd')](function(_0x33d9fb){_0x405c9b=_0x33d9fb[0x0];var _0x1d9c5b=[];var _0x2ce374=[];_0x3c9492[_0x60fc('0x98')](function(_0x224e9c){if(_0x224e9c[_0x60fc('0x94')]){var _0x563d70=_0x224e9c[_0x60fc('0x94')][_0x60fc('0x3d')](_0x224e9c[_0x60fc('0x94')][_0x60fc('0x3e')]('.')+0x1);if(_0x563d70===_0x60fc('0x9a')||_0x563d70===_0x60fc('0x9b')||_0x563d70===_0x60fc('0x9c')||_0x563d70===_0x60fc('0x9d')||_0x563d70===_0x60fc('0x9e')||_0x563d70===_0x60fc('0x9f')||_0x563d70===_0x60fc('0xa0')||_0x563d70===_0x60fc('0xa1')||_0x563d70===_0x60fc('0xa2')||_0x563d70===_0x60fc('0xa3')){_0x1d9c5b[_0x60fc('0x96')](getInputList(_0x197687,_0x247dac,_0x563d70,_0x2ce374,_0x5a24fa[_0x60fc('0x97')],_0x224e9c[_0x60fc('0x97')],_0x5a2a01));}}});return Promise[_0x60fc('0xa4')](_0x1d9c5b);})['then'](function(_0x33e084){_0x258afe=_0x33e084[0x0];var _0x1e5738=_0x22292f[_0x60fc('0x7d')](_0x405c9b)[_0x60fc('0x7d')](_0x258afe);var _0xe0e255={'count':_0x1e5738[_0x60fc('0x21')],'rows':_0x1e5738};return _0xe0e255;})[_0x60fc('0xd')](respondWithResult(_0x3389d0,null))[_0x60fc('0x2b')](function(_0x396e18){var _0x19a4b3=_0x89db9c[_0x60fc('0x1a')][_0x60fc('0xa5')]?0x1f4:_0x396e18[_0x60fc('0xa6')]||0x1f4;logger[_0x60fc('0x11')](_0x396e18['stack']);delete _0x396e18[_0x60fc('0x12')];if(_0x19a4b3===0x191){_0x19a4b3=0x190;}_0x3389d0[_0x60fc('0x6')](_0x19a4b3)['send'](_0x89db9c[_0x60fc('0x1a')]['test']?{'message':_0x60fc('0xa7'),'statusCode':_0x396e18[_0x60fc('0xa6')]}:_0x396e18);});};function getSelectList(_0x56afb2,_0x5c7b05,_0x5444f1,_0x5015e5,_0x1d1651,_0x55096b){var _0x2361a9={'method':_0x60fc('0x8b'),'uri':_0x56afb2+_0x60fc('0x8e')+_0x5015e5+_0x60fc('0xa8')+_0x1d1651+_0x60fc('0xa9')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x60fc('0xaa')+_0x55096b,'If-None-Match':null,'OData-Version':_0x60fc('0x90')},'json':!![]};return rp(_0x2361a9)[_0x60fc('0xd')](function(_0x5ce310){var _0x34cf67=[];var _0x2a2356=_0x5ce310[_0x60fc('0xab')][_0x60fc('0xac')];_0x2a2356['forEach'](function(_0x5361c9){_0x34cf67[_0x60fc('0x96')]({'name':_0x5361c9[_0x60fc('0xad')]['UserLocalizedLabel'][_0x60fc('0xad')],'value':String(_0x5361c9[_0x60fc('0xae')])});});var _0x4394d0={'id':_0x5c7b05+'_'+_0x5ce310[_0x60fc('0x93')],'name':_0x5ce310[_0x60fc('0xaf')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x34cf67};_0x5444f1[_0x60fc('0x96')](_0x4394d0);return _0x5444f1;});}function getBooleanList(_0x1775e6,_0x3b2a2c,_0x21074f,_0x300e39,_0x3ea096,_0x3897e2){var _0x2dbd0d={'method':_0x60fc('0x8b'),'uri':_0x1775e6+'EntityDefinitions('+_0x300e39+_0x60fc('0xa8')+_0x3ea096+_0x60fc('0xb0'),'headers':{'Authorization':_0x60fc('0xaa')+_0x3897e2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2dbd0d)['then'](function(_0x639680){var _0x58d11c=[];_0x58d11c[_0x60fc('0x96')]({'name':_0x639680['OptionSet'][_0x60fc('0xb1')][_0x60fc('0xad')][_0x60fc('0xb2')]['Label'],'value':_0x60fc('0xb3')},{'name':_0x639680['OptionSet'][_0x60fc('0xb4')][_0x60fc('0xad')][_0x60fc('0xb2')][_0x60fc('0xad')],'value':_0x60fc('0xb5')});var _0x578f91={'id':_0x3b2a2c+'_'+_0x639680[_0x60fc('0x93')],'name':_0x639680[_0x60fc('0xaf')][_0x60fc('0xb2')][_0x60fc('0xad')],'custom':![],'options':_0x58d11c};_0x21074f['push'](_0x578f91);return _0x21074f;});}function getInputList(_0x3cac52,_0x57a016,_0x34021d,_0x254df6,_0x2b2d57,_0x2d910a,_0x1e6520){var _0x89a297={'method':_0x60fc('0x8b'),'uri':_0x3cac52+'EntityDefinitions('+_0x2b2d57+_0x60fc('0xa8')+_0x2d910a+_0x60fc('0xb6')+_0x34021d+_0x60fc('0xb7'),'headers':{'Authorization':'Bearer\x20'+_0x1e6520,'If-None-Match':null,'OData-Version':_0x60fc('0x90')},'json':!![]};return rp(_0x89a297)[_0x60fc('0xd')](function(_0x4ad9f1){var _0x2f947c={'id':_0x57a016+'_'+_0x4ad9f1['LogicalName'],'name':_0x4ad9f1[_0x60fc('0xaf')][_0x60fc('0xb2')]?_0x4ad9f1[_0x60fc('0xaf')][_0x60fc('0xb2')][_0x60fc('0xad')]:_0x4ad9f1[_0x60fc('0x93')],'custom':![],'options':[]};_0x254df6[_0x60fc('0x96')](_0x2f947c);return _0x254df6;});}
\ No newline at end of file