Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / api / intSalesforceAccount / intSalesforceAccount.controller.js
index b0aeecb..62ea8ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','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~!@#$%^&-_=+[{]}.','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','set','Content-Range','apply','destroy','sendStatus','name','index','map','SalesforceAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','update','SalesforceConfiguration','getConfigurations','addConfiguration','findOne','AccountId','channel','type','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','slice','substring','lastIndexOf','Connection','login','password','concat','securityToken','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Case','Origin','IsEscalated','SuppliedCompany','remove','custom','picklistValues','label','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','eml-format'];(function(_0x501da2,_0x1a2f89){var _0x542b17=function(_0x4ea75e){while(--_0x4ea75e){_0x501da2['push'](_0x501da2['shift']());}};_0x542b17(++_0x1a2f89);}(_0x7a54,0x106));var _0x47a5=function(_0x9fc9a5,_0x1fd06f){_0x9fc9a5=_0x9fc9a5-0x0;var _0x3cad3f=_0x7a54[_0x9fc9a5];return _0x3cad3f;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];var integrations=require(_0x47a5('0x15'));var jayson=require(_0x47a5('0x16'));var client=jayson[_0x47a5('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x44bd3e,_0x221b54,_0x1cf309){if(_0x1cf309){var _0x711793=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x711793[_0x47a5('0x18')](_0x221b54)){return _0x44bd3e;}else{throw new db[(_0x47a5('0x19'))][(_0x47a5('0x1a'))](_0x47a5('0x1b'));}}else{return _0x44bd3e;}}function respondWithRpcPromise(_0x4e99a8,_0x362359,_0x11faf5,_0x3b001e){return new BPromise(function(_0x2a2cbb,_0x1ef44c){var _0x574af6=_0x3b001e||client;return _0x574af6['request'](_0x4e99a8,_0x11faf5)[_0x47a5('0x1c')](function(_0x4b966e){logger['info'](_0x47a5('0x1d'),_0x362359,_0x47a5('0x1e'));logger[_0x47a5('0x1f')](_0x47a5('0x20'),_0x362359,_0x47a5('0x1e'),JSON[_0x47a5('0x21')](_0x4b966e));if(_0x4b966e[_0x47a5('0x22')]){if(_0x4b966e[_0x47a5('0x22')][_0x47a5('0x23')]===0x1f4){logger['error'](_0x47a5('0x1d'),_0x362359,_0x4b966e[_0x47a5('0x22')]['message']);return _0x1ef44c(_0x4b966e[_0x47a5('0x22')][_0x47a5('0x24')]);}logger[_0x47a5('0x22')]('SalesforceAccount,\x20%s,\x20%s',_0x362359,_0x4b966e[_0x47a5('0x22')][_0x47a5('0x24')]);return _0x2a2cbb(_0x4b966e[_0x47a5('0x22')][_0x47a5('0x24')]);}else{logger['info'](_0x47a5('0x1d'),_0x362359,_0x47a5('0x1e'));_0x2a2cbb(_0x4b966e['result'][_0x47a5('0x24')]);}})[_0x47a5('0x25')](function(_0x4437f1){logger[_0x47a5('0x22')](_0x47a5('0x1d'),_0x362359,_0x4437f1);_0x1ef44c(_0x4437f1);});});}function respondWithStatusCode(_0x50bf17,_0x53078a){_0x53078a=_0x53078a||0xcc;return function(_0x136745){if(_0x136745){return _0x50bf17['sendStatus'](_0x53078a);}return _0x50bf17[_0x47a5('0x26')](_0x53078a)['end']();};}function respondWithResult(_0x23cb77,_0x378208){_0x378208=_0x378208||0xc8;return function(_0x36ad34){if(_0x36ad34){return _0x23cb77[_0x47a5('0x26')](_0x378208)[_0x47a5('0x27')](_0x36ad34);}};}function respondWithFilteredResult(_0x3ba0b7,_0x24b162){return function(_0x136b14){if(_0x136b14){var _0x16631f=_0x136b14[_0x47a5('0x28')],_0x361bfa=_0x24b162['offset'],_0x1127f8=_0x24b162[_0x47a5('0x29')]+_0x24b162['limit'],_0x11a4fa;if(_0x1127f8>=_0x16631f){_0x1127f8=_0x16631f;_0x11a4fa=0xc8;}else{_0x11a4fa=0xce;}_0x3ba0b7[_0x47a5('0x26')](_0x11a4fa);return _0x3ba0b7[_0x47a5('0x2a')](_0x47a5('0x2b'),_0x361bfa+'-'+_0x1127f8+'/'+_0x16631f)['json'](_0x136b14);}return null;};}function patchUpdates(_0x256650){return function(_0x625952){try{jsonpatch[_0x47a5('0x2c')](_0x625952,_0x256650,!![]);}catch(_0x1f1c68){return BPromise['reject'](_0x1f1c68);}return _0x625952['save']();};}function saveUpdates(_0x6f9a12,_0xfb5ddb){return function(_0x5bd7eb){if(_0x5bd7eb){return _0x5bd7eb['update'](_0x6f9a12)[_0x47a5('0x1c')](function(_0x51544e){return _0x51544e;});}return null;};}function removeEntity(_0x57bff6,_0x42f70c){return function(_0x53119b){if(_0x53119b){return _0x53119b[_0x47a5('0x2d')]()[_0x47a5('0x1c')](function(){_0x57bff6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x274e34,_0x5910bb){return function(_0x403028){if(!_0x403028){_0x274e34[_0x47a5('0x2e')](0x194);}return _0x403028;};}function handleError(_0xf269a8,_0x52749b){_0x52749b=_0x52749b||0x1f4;return function(_0x18f7e9){logger['error'](_0x18f7e9['stack']);if(_0x18f7e9[_0x47a5('0x2f')]){delete _0x18f7e9['name'];}_0xf269a8[_0x47a5('0x26')](_0x52749b)['send'](_0x18f7e9);};}exports[_0x47a5('0x30')]=function(_0x3534cb,_0x38c8d4){var _0x199698={},_0x36add5={},_0xed6320={'count':0x0,'rows':[]};var _0xee582c=_[_0x47a5('0x31')](db[_0x47a5('0x32')]['rawAttributes'],function(_0x396a9a){return{'name':_0x396a9a[_0x47a5('0x33')],'type':_0x396a9a['type'][_0x47a5('0x34')]};});_0x36add5[_0x47a5('0x35')]=_[_0x47a5('0x31')](_0xee582c,'name');_0x36add5[_0x47a5('0x36')]=_[_0x47a5('0x37')](_0x3534cb['query']);_0x36add5[_0x47a5('0x38')]=_[_0x47a5('0x39')](_0x36add5['model'],_0x36add5['query']);_0x199698['attributes']=_[_0x47a5('0x39')](_0x36add5['model'],qs[_0x47a5('0x3a')](_0x3534cb[_0x47a5('0x36')][_0x47a5('0x3a')]));_0x199698[_0x47a5('0x3b')]=_0x199698[_0x47a5('0x3b')][_0x47a5('0x3c')]?_0x199698[_0x47a5('0x3b')]:_0x36add5[_0x47a5('0x35')];if(!_0x3534cb[_0x47a5('0x36')][_0x47a5('0x3d')](_0x47a5('0x3e'))){_0x199698[_0x47a5('0x3f')]=qs[_0x47a5('0x3f')](_0x3534cb['query'][_0x47a5('0x3f')]);_0x199698[_0x47a5('0x29')]=qs[_0x47a5('0x29')](_0x3534cb[_0x47a5('0x36')]['offset']);}_0x199698[_0x47a5('0x40')]=qs['sort'](_0x3534cb['query']['sort']);_0x199698['where']=qs[_0x47a5('0x38')](_['pick'](_0x3534cb[_0x47a5('0x36')],_0x36add5[_0x47a5('0x38')]));if(_0x3534cb[_0x47a5('0x36')]['filter']){_0x199698[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x199698['where'],{'$or':_['map'](_0xee582c,function(_0xbe21d9){if(_0xbe21d9['type']!==_0x47a5('0x43')){var _0x4703b2={};_0x4703b2[_0xbe21d9[_0x47a5('0x2f')]]={'$like':'%'+_0x3534cb[_0x47a5('0x36')][_0x47a5('0x44')]+'%'};return _0x4703b2;}})});}_0x199698=_[_0x47a5('0x42')]({},_0x199698,_0x3534cb[_0x47a5('0x45')]);var _0x17cc42={'where':_0x199698[_0x47a5('0x41')]};return db[_0x47a5('0x32')][_0x47a5('0x28')](_0x17cc42)[_0x47a5('0x1c')](function(_0xe28d76){_0xed6320[_0x47a5('0x28')]=_0xe28d76;if(_0x3534cb[_0x47a5('0x36')][_0x47a5('0x46')]){_0x199698['include']=[{'all':!![]}];}return db[_0x47a5('0x32')][_0x47a5('0x47')](_0x199698);})['then'](function(_0x52b3a8){_0xed6320[_0x47a5('0x48')]=_0x52b3a8;return _0xed6320;})['then'](respondWithFilteredResult(_0x38c8d4,_0x199698))[_0x47a5('0x25')](handleError(_0x38c8d4,null));};exports[_0x47a5('0x49')]=function(_0x54c35f,_0x4f62d3){var _0x3d85cc={'raw':![],'where':{'id':_0x54c35f[_0x47a5('0x4a')]['id']}},_0x52d409={};_0x52d409[_0x47a5('0x35')]=_[_0x47a5('0x37')](db[_0x47a5('0x32')][_0x47a5('0x4b')]);_0x52d409[_0x47a5('0x36')]=_[_0x47a5('0x37')](_0x54c35f['query']);_0x52d409['filters']=_[_0x47a5('0x39')](_0x52d409[_0x47a5('0x35')],_0x52d409[_0x47a5('0x36')]);_0x3d85cc[_0x47a5('0x3b')]=_[_0x47a5('0x39')](_0x52d409[_0x47a5('0x35')],qs[_0x47a5('0x3a')](_0x54c35f['query'][_0x47a5('0x3a')]));_0x3d85cc[_0x47a5('0x3b')]=_0x3d85cc[_0x47a5('0x3b')]['length']?_0x3d85cc[_0x47a5('0x3b')]:_0x52d409['model'];if(_0x54c35f[_0x47a5('0x36')][_0x47a5('0x46')]){_0x3d85cc[_0x47a5('0x4c')]=[{'all':!![]}];}_0x3d85cc=_[_0x47a5('0x42')]({},_0x3d85cc,_0x54c35f['options']);return db[_0x47a5('0x32')][_0x47a5('0x4d')](_0x3d85cc)[_0x47a5('0x1c')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x1c')](respondWithResult(_0x4f62d3,null))[_0x47a5('0x25')](handleError(_0x4f62d3,null));};exports[_0x47a5('0x4e')]=function(_0x24e9f4,_0x481089){return db[_0x47a5('0x32')][_0x47a5('0x4e')](_0x24e9f4[_0x47a5('0x4f')],{})[_0x47a5('0x1c')](respondWithResult(_0x481089,0xc9))[_0x47a5('0x25')](handleError(_0x481089,null));};exports[_0x47a5('0x50')]=function(_0x572233,_0x1ad6a9){if(_0x572233[_0x47a5('0x4f')]['id']){delete _0x572233[_0x47a5('0x4f')]['id'];}return db['SalesforceAccount'][_0x47a5('0x4d')]({'where':{'id':_0x572233[_0x47a5('0x4a')]['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x1ad6a9,null))['then'](saveUpdates(_0x572233['body'],null))[_0x47a5('0x1c')](respondWithResult(_0x1ad6a9,null))[_0x47a5('0x25')](handleError(_0x1ad6a9,null));};exports['destroy']=function(_0x4cf792,_0x6d6b2b){return db['SalesforceAccount'][_0x47a5('0x4d')]({'where':{'id':_0x4cf792['params']['id']}})['then'](handleEntityNotFound(_0x6d6b2b,null))[_0x47a5('0x1c')](removeEntity(_0x6d6b2b,null))[_0x47a5('0x25')](handleError(_0x6d6b2b,null));};exports['getConfigurations']=function(_0x1b958b,_0x72fe,_0x4b706a){var _0x5b6127={};var _0x16b4fd={};var _0x30d482;var _0x867da0;return db[_0x47a5('0x32')]['findOne']({'where':{'id':_0x1b958b[_0x47a5('0x4a')]['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x72fe,null))[_0x47a5('0x1c')](function(_0x5a33b8){if(_0x5a33b8){_0x30d482=_0x5a33b8;_0x16b4fd[_0x47a5('0x35')]=_['keys'](db[_0x47a5('0x51')][_0x47a5('0x4b')]);_0x16b4fd[_0x47a5('0x36')]=_[_0x47a5('0x37')](_0x1b958b[_0x47a5('0x36')]);_0x16b4fd['filters']=_[_0x47a5('0x39')](_0x16b4fd['model'],_0x16b4fd['query']);_0x5b6127['attributes']=_['intersection'](_0x16b4fd[_0x47a5('0x35')],qs[_0x47a5('0x3a')](_0x1b958b[_0x47a5('0x36')]['fields']));_0x5b6127['attributes']=_0x5b6127[_0x47a5('0x3b')][_0x47a5('0x3c')]?_0x5b6127[_0x47a5('0x3b')]:_0x16b4fd[_0x47a5('0x35')];_0x5b6127[_0x47a5('0x40')]=qs['sort'](_0x1b958b[_0x47a5('0x36')]['sort']);_0x5b6127[_0x47a5('0x41')]=qs[_0x47a5('0x38')](_['pick'](_0x1b958b[_0x47a5('0x36')],_0x16b4fd[_0x47a5('0x38')]));if(_0x1b958b[_0x47a5('0x36')][_0x47a5('0x44')]){_0x5b6127[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x5b6127[_0x47a5('0x41')],{'$or':_[_0x47a5('0x31')](_0x5b6127['attributes'],function(_0x2dcc3b){var _0x2a3a57={};_0x2a3a57[_0x2dcc3b]={'$like':'%'+_0x1b958b[_0x47a5('0x36')][_0x47a5('0x44')]+'%'};return _0x2a3a57;})});}_0x5b6127=_[_0x47a5('0x42')]({},_0x5b6127,_0x1b958b['options']);return _0x30d482[_0x47a5('0x52')](_0x5b6127);}})[_0x47a5('0x1c')](function(_0x1224bc){if(_0x1224bc){_0x867da0=_0x1224bc[_0x47a5('0x3c')];if(!_0x1b958b[_0x47a5('0x36')][_0x47a5('0x3d')](_0x47a5('0x3e'))){_0x5b6127[_0x47a5('0x3f')]=qs[_0x47a5('0x3f')](_0x1b958b[_0x47a5('0x36')][_0x47a5('0x3f')]);_0x5b6127[_0x47a5('0x29')]=qs[_0x47a5('0x29')](_0x1b958b[_0x47a5('0x36')][_0x47a5('0x29')]);}return _0x30d482['getConfigurations'](_0x5b6127);}})[_0x47a5('0x1c')](function(_0x284fb8){if(_0x284fb8){return _0x284fb8?{'count':_0x867da0,'rows':_0x284fb8}:null;}})[_0x47a5('0x1c')](respondWithResult(_0x72fe,null))['catch'](handleError(_0x72fe,null));};exports[_0x47a5('0x53')]=function(_0x2e46af,_0x36c67,_0x26f1ac){if(_0x2e46af['body']['id']){delete _0x2e46af[_0x47a5('0x4f')]['id'];}return db['SalesforceAccount'][_0x47a5('0x54')]({'where':{'id':_0x2e46af['params']['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x36c67,null))['then'](function(_0x7c1190){if(_0x7c1190){_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x55')]=_0x7c1190['id'];_0x2e46af['body']['Subjects']=integrations['getSubjects'](_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x56')],_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x57')]);_0x2e46af['body'][_0x47a5('0x58')]=integrations[_0x47a5('0x59')](_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x56')],_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x57')]);return db[_0x47a5('0x51')][_0x47a5('0x4e')](_0x2e46af[_0x47a5('0x4f')],{'include':[{'model':db[_0x47a5('0x5a')],'as':_0x47a5('0x5b')},{'model':db[_0x47a5('0x5a')],'as':'Descriptions'}]});}return null;})[_0x47a5('0x1c')](respondWithResult(_0x36c67,null))['catch'](handleError(_0x36c67,null));};exports[_0x47a5('0x5c')]=function(_0x2ac30f,_0x281e5f,_0x12fec9){var _0x40e584;var _0xa9c853='';var _0x12025a=_0x47a5('0x5d');return db[_0x47a5('0x32')][_0x47a5('0x54')]({'where':{'id':_0x2ac30f[_0x47a5('0x4a')]['id']},'attributes':['id',_0x47a5('0x5e'),_0x47a5('0x5f'),_0x47a5('0x60'),_0x47a5('0x61'),'password','securityToken']})['then'](handleEntityNotFound(_0x281e5f,null))['then'](function(_0x490e28){if(_0x490e28){_0xa9c853=_0x490e28[_0x47a5('0x5e')];var _0x5d6916=_0xa9c853[_0x47a5('0x62')](-0x1);if(_0x5d6916==='/'){_0xa9c853=_0xa9c853[_0x47a5('0x63')](0x0,_0xa9c853[_0x47a5('0x64')](_0x5d6916));}_0x40e584=new jsforce[(_0x47a5('0x65'))]({'oauth2':{'loginUrl':_0xa9c853,'clientId':_0x490e28[_0x47a5('0x5f')],'clientSecret':_0x490e28[_0x47a5('0x60')]}});return _0x40e584[_0x47a5('0x66')](_0x490e28[_0x47a5('0x61')],_0x490e28[_0x47a5('0x67')][_0x47a5('0x68')](_0x490e28[_0x47a5('0x69')]));}})['then'](function(_0x18fa31){if(_0x18fa31){if(!_[_0x47a5('0x6a')](_0x2ac30f[_0x47a5('0x36')]['ticketType'])){_0x12025a=_0x2ac30f[_0x47a5('0x36')][_0x47a5('0x6b')];}return _0x40e584[_0x47a5('0x6c')](_0x12025a)['describe']();}})[_0x47a5('0x1c')](function(_0x5205ba){var _0x49d93d=[_0x47a5('0x6d'),_0x47a5('0x6e'),_0x47a5('0x6f'),_0x47a5('0x70'),_0x47a5('0x71'),_0x47a5('0x72'),'Status','Type'];if(!_[_0x47a5('0x6a')](_0x2ac30f['query'][_0x47a5('0x6b')])&&_0x2ac30f[_0x47a5('0x36')][_0x47a5('0x6b')]===_0x47a5('0x73')){_0x49d93d=['Type',_0x47a5('0x74'),'Reason','Status',_0x47a5('0x72'),_0x47a5('0x75'),'SuppliedName',_0x47a5('0x76')];}if(_0x5205ba){_[_0x47a5('0x77')](_0x5205ba[_0x47a5('0x3a')],function(_0x4c25ec){return _0x4c25ec[_0x47a5('0x78')]===![]&&!_0x49d93d['includes'](_0x4c25ec[_0x47a5('0x2f')]);});return{'count':_0x5205ba[_0x47a5('0x3a')][_0x47a5('0x3c')],'rows':_['map'](_0x5205ba[_0x47a5('0x3a')],function(_0x196600){return{'id':_0x196600[_0x47a5('0x2f')],'name':_0x196600['label'],'custom':_0x196600[_0x47a5('0x78')],'options':_0x196600['picklistValues'][_0x47a5('0x3c')]>0x0?_['map'](_0x196600[_0x47a5('0x79')],function(_0x20d8bd){return{'name':_0x20d8bd[_0x47a5('0x7a')],'value':_0x20d8bd[_0x47a5('0x7b')]};}):_0x196600['type']==_0x47a5('0x7c')?[{'name':_0x47a5('0x7d'),'value':_0x47a5('0x7e')},{'name':_0x47a5('0x7f'),'value':_0x47a5('0x80')}]:[]};})};}})['then'](respondWithResult(_0x281e5f,null))['catch'](function(_0x569550){var _0x4ab01f=_0x2ac30f[_0x47a5('0x36')][_0x47a5('0x18')]?0x1f4:_0x569550[_0x47a5('0x81')]||0x1f4;logger['error'](_0x47a5('0x82'),_0x47a5('0x5c'),_0x4ab01f,JSON['stringify'](_0x569550));delete _0x569550[_0x47a5('0x2f')];if(_0x4ab01f===0x191){_0x4ab01f=0x190;}_0x281e5f[_0x47a5('0x26')](_0x4ab01f)[_0x47a5('0x83')](_0x2ac30f[_0x47a5('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x569550[_0x47a5('0x81')]}:_0x569550);});};
\ No newline at end of file
+var _0xb4ae=['string','int','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','count','offset','limit','status','set','Content-Range','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','SalesforceAccount','includeAll','include','findAll','show','keys','length','options','find','create','params','body','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','lastIndexOf','Connection','login','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description'];(function(_0x523de1,_0x438192){var _0x4402c7=function(_0x10df18){while(--_0x10df18){_0x523de1['push'](_0x523de1['shift']());}};_0x4402c7(++_0x438192);}(_0xb4ae,0x198));var _0xeb4a=function(_0x1fcda0,_0x5e6410){_0x1fcda0=_0x1fcda0-0x0;var _0x540337=_0xb4ae[_0x1fcda0];return _0x540337;};'use strict';var pdf=require(_0xeb4a('0x0'));var emlformat=require(_0xeb4a('0x1'));var rimraf=require(_0xeb4a('0x2'));var zipdir=require(_0xeb4a('0x3'));var jsonpatch=require(_0xeb4a('0x4'));var rp=require(_0xeb4a('0x5'));var moment=require(_0xeb4a('0x6'));var BPromise=require(_0xeb4a('0x7'));var Mustache=require(_0xeb4a('0x8'));var util=require('util');var path=require(_0xeb4a('0x9'));var sox=require(_0xeb4a('0xa'));var csv=require(_0xeb4a('0xb'));var ejs=require(_0xeb4a('0xc'));var fs=require('fs');var _=require(_0xeb4a('0xd'));var squel=require(_0xeb4a('0xe'));var crypto=require(_0xeb4a('0xf'));var jsforce=require(_0xeb4a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xeb4a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb4a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeb4a('0x12'));var hardwareService=require(_0xeb4a('0x13'));var logger=require(_0xeb4a('0x14'))(_0xeb4a('0x15'));var utils=require('../../config/utils');var config=require(_0xeb4a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb4a('0x17'))['db'];var integrations=require(_0xeb4a('0x18'));var jayson=require(_0xeb4a('0x19'));var client=jayson[_0xeb4a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53b1d1,_0x261b3a,_0x2e421d,_0x2daeb8){return new BPromise(function(_0x3be811,_0x2958cc){var _0x503589=_0x2daeb8||client;return _0x503589[_0xeb4a('0x1b')](_0x53b1d1,_0x2e421d)[_0xeb4a('0x1c')](function(_0x31ef6e){logger['info'](_0xeb4a('0x1d'),_0x261b3a,_0xeb4a('0x1e'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x261b3a,_0xeb4a('0x1e'),JSON[_0xeb4a('0x1f')](_0x31ef6e));if(_0x31ef6e[_0xeb4a('0x20')]){if(_0x31ef6e['error'][_0xeb4a('0x21')]===0x1f4){logger[_0xeb4a('0x20')]('SalesforceAccount,\x20%s,\x20%s',_0x261b3a,_0x31ef6e['error'][_0xeb4a('0x22')]);return _0x2958cc(_0x31ef6e[_0xeb4a('0x20')][_0xeb4a('0x22')]);}logger[_0xeb4a('0x20')](_0xeb4a('0x1d'),_0x261b3a,_0x31ef6e[_0xeb4a('0x20')]['message']);return _0x3be811(_0x31ef6e[_0xeb4a('0x20')]['message']);}else{logger['info'](_0xeb4a('0x1d'),_0x261b3a,_0xeb4a('0x1e'));_0x3be811(_0x31ef6e['result'][_0xeb4a('0x22')]);}})[_0xeb4a('0x23')](function(_0x35da0b){logger[_0xeb4a('0x20')](_0xeb4a('0x1d'),_0x261b3a,_0x35da0b);_0x2958cc(_0x35da0b);});});}function respondWithStatusCode(_0x4ddc8e,_0x8e9684){_0x8e9684=_0x8e9684||0xcc;return function(_0x24adfb){if(_0x24adfb){return _0x4ddc8e[_0xeb4a('0x24')](_0x8e9684);}return _0x4ddc8e['status'](_0x8e9684)['end']();};}function respondWithResult(_0x3ac6d8,_0x42bf09){_0x42bf09=_0x42bf09||0xc8;return function(_0x5a865a){if(_0x5a865a){return _0x3ac6d8['status'](_0x42bf09)['json'](_0x5a865a);}};}function respondWithFilteredResult(_0xa63993,_0x1830b7){return function(_0x429f74){if(_0x429f74){var _0x3bb481=_0x429f74[_0xeb4a('0x25')],_0x37ea01=_0x1830b7[_0xeb4a('0x26')],_0x5b61af=_0x1830b7['offset']+_0x1830b7[_0xeb4a('0x27')],_0x971be7;if(_0x5b61af>=_0x3bb481){_0x5b61af=_0x3bb481;_0x971be7=0xc8;}else{_0x971be7=0xce;}_0xa63993[_0xeb4a('0x28')](_0x971be7);return _0xa63993[_0xeb4a('0x29')](_0xeb4a('0x2a'),_0x37ea01+'-'+_0x5b61af+'/'+_0x3bb481)['json'](_0x429f74);}return null;};}function patchUpdates(_0x11a377){return function(_0x23d9a6){try{jsonpatch['apply'](_0x23d9a6,_0x11a377,!![]);}catch(_0x4dc581){return BPromise['reject'](_0x4dc581);}return _0x23d9a6[_0xeb4a('0x2b')]();};}function saveUpdates(_0xd4efc1,_0x2c5d99){return function(_0x1e08f2){if(_0x1e08f2){return _0x1e08f2[_0xeb4a('0x2c')](_0xd4efc1)[_0xeb4a('0x1c')](function(_0x36ffd1){return _0x36ffd1;});}return null;};}function removeEntity(_0x3220a5,_0x1b4909){return function(_0x305645){if(_0x305645){return _0x305645[_0xeb4a('0x2d')]()[_0xeb4a('0x1c')](function(){_0x3220a5[_0xeb4a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5371fc,_0x2ef7fd){return function(_0x118f75){if(!_0x118f75){_0x5371fc[_0xeb4a('0x24')](0x194);}return _0x118f75;};}function handleError(_0x145e02,_0x11ecdc){_0x11ecdc=_0x11ecdc||0x1f4;return function(_0x494f17){logger[_0xeb4a('0x20')](_0x494f17[_0xeb4a('0x2e')]);if(_0x494f17[_0xeb4a('0x2f')]){delete _0x494f17[_0xeb4a('0x2f')];}_0x145e02[_0xeb4a('0x28')](_0x11ecdc)[_0xeb4a('0x30')](_0x494f17);};}exports[_0xeb4a('0x31')]=function(_0x2cef4d,_0x4a2c33){var _0x3404f9={},_0x371f40={},_0x3b6826={'count':0x0,'rows':[]};var _0x47cffa=_[_0xeb4a('0x32')](db['SalesforceAccount'][_0xeb4a('0x33')],function(_0x41497f){return{'name':_0x41497f[_0xeb4a('0x34')],'type':_0x41497f[_0xeb4a('0x35')][_0xeb4a('0x36')]};});_0x371f40[_0xeb4a('0x37')]=_[_0xeb4a('0x32')](_0x47cffa,'name');_0x371f40['query']=_['keys'](_0x2cef4d[_0xeb4a('0x38')]);_0x371f40[_0xeb4a('0x39')]=_[_0xeb4a('0x3a')](_0x371f40[_0xeb4a('0x37')],_0x371f40[_0xeb4a('0x38')]);_0x3404f9[_0xeb4a('0x3b')]=_[_0xeb4a('0x3a')](_0x371f40[_0xeb4a('0x37')],qs['fields'](_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x3c')]));_0x3404f9['attributes']=_0x3404f9[_0xeb4a('0x3b')]['length']?_0x3404f9['attributes']:_0x371f40[_0xeb4a('0x37')];if(!_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x3d')](_0xeb4a('0x3e'))){_0x3404f9[_0xeb4a('0x27')]=qs[_0xeb4a('0x27')](_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x27')]);_0x3404f9[_0xeb4a('0x26')]=qs[_0xeb4a('0x26')](_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x26')]);}_0x3404f9[_0xeb4a('0x3f')]=qs[_0xeb4a('0x40')](_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x40')]);_0x3404f9[_0xeb4a('0x41')]=qs[_0xeb4a('0x39')](_[_0xeb4a('0x42')](_0x2cef4d['query'],_0x371f40['filters']),_0x47cffa);if(_0x2cef4d[_0xeb4a('0x38')]['filter']){_0x3404f9[_0xeb4a('0x41')]=_[_0xeb4a('0x43')](_0x3404f9[_0xeb4a('0x41')],{'$or':_['map'](_0x47cffa,function(_0x5c3cb0){if(_0x5c3cb0[_0xeb4a('0x35')]!==_0xeb4a('0x44')){var _0x1de8f5={};_0x1de8f5[_0x5c3cb0['name']]={'$like':'%'+_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x45')]+'%'};return _0x1de8f5;}})});}_0x3404f9=_[_0xeb4a('0x43')]({},_0x3404f9,_0x2cef4d['options']);var _0xa8bc4e={'where':_0x3404f9['where']};return db[_0xeb4a('0x46')][_0xeb4a('0x25')](_0xa8bc4e)[_0xeb4a('0x1c')](function(_0x3d4d6e){_0x3b6826[_0xeb4a('0x25')]=_0x3d4d6e;if(_0x2cef4d[_0xeb4a('0x38')][_0xeb4a('0x47')]){_0x3404f9[_0xeb4a('0x48')]=[{'all':!![]}];}return db[_0xeb4a('0x46')][_0xeb4a('0x49')](_0x3404f9);})['then'](function(_0x355122){_0x3b6826['rows']=_0x355122;return _0x3b6826;})[_0xeb4a('0x1c')](respondWithFilteredResult(_0x4a2c33,_0x3404f9))[_0xeb4a('0x23')](handleError(_0x4a2c33,null));};exports[_0xeb4a('0x4a')]=function(_0x3c9823,_0x5dd805){var _0x26e08e={'raw':![],'where':{'id':_0x3c9823['params']['id']}},_0x3fd739={};_0x3fd739['model']=_[_0xeb4a('0x4b')](db[_0xeb4a('0x46')]['rawAttributes']);_0x3fd739[_0xeb4a('0x38')]=_['keys'](_0x3c9823[_0xeb4a('0x38')]);_0x3fd739['filters']=_['intersection'](_0x3fd739[_0xeb4a('0x37')],_0x3fd739['query']);_0x26e08e['attributes']=_[_0xeb4a('0x3a')](_0x3fd739[_0xeb4a('0x37')],qs[_0xeb4a('0x3c')](_0x3c9823['query'][_0xeb4a('0x3c')]));_0x26e08e[_0xeb4a('0x3b')]=_0x26e08e[_0xeb4a('0x3b')][_0xeb4a('0x4c')]?_0x26e08e[_0xeb4a('0x3b')]:_0x3fd739[_0xeb4a('0x37')];if(_0x3c9823['query'][_0xeb4a('0x47')]){_0x26e08e[_0xeb4a('0x48')]=[{'all':!![]}];}_0x26e08e=_[_0xeb4a('0x43')]({},_0x26e08e,_0x3c9823[_0xeb4a('0x4d')]);return db['SalesforceAccount'][_0xeb4a('0x4e')](_0x26e08e)['then'](handleEntityNotFound(_0x5dd805,null))['then'](respondWithResult(_0x5dd805,null))[_0xeb4a('0x23')](handleError(_0x5dd805,null));};exports[_0xeb4a('0x4f')]=function(_0x2598fd,_0x72ebf4){return db[_0xeb4a('0x46')][_0xeb4a('0x4f')](_0x2598fd['body'],{})['then'](respondWithResult(_0x72ebf4,0xc9))[_0xeb4a('0x23')](handleError(_0x72ebf4,null));};exports[_0xeb4a('0x2c')]=function(_0x5206e0,_0x5e9819){if(_0x5206e0['body']['id']){delete _0x5206e0['body']['id'];}return db[_0xeb4a('0x46')]['find']({'where':{'id':_0x5206e0[_0xeb4a('0x50')]['id']}})[_0xeb4a('0x1c')](handleEntityNotFound(_0x5e9819,null))[_0xeb4a('0x1c')](saveUpdates(_0x5206e0[_0xeb4a('0x51')],null))['then'](respondWithResult(_0x5e9819,null))[_0xeb4a('0x23')](handleError(_0x5e9819,null));};exports[_0xeb4a('0x2d')]=function(_0x100a05,_0x300831){return db[_0xeb4a('0x46')]['find']({'where':{'id':_0x100a05[_0xeb4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x300831,null))[_0xeb4a('0x1c')](removeEntity(_0x300831,null))[_0xeb4a('0x23')](handleError(_0x300831,null));};exports['getConfigurations']=function(_0x24332a,_0x157d07,_0x5d573a){var _0x41c402={};var _0xf9229f={};var _0x10f727;var _0x847d33;return db[_0xeb4a('0x46')][_0xeb4a('0x52')]({'where':{'id':_0x24332a[_0xeb4a('0x50')]['id']}})[_0xeb4a('0x1c')](handleEntityNotFound(_0x157d07,null))[_0xeb4a('0x1c')](function(_0x1c8ecf){if(_0x1c8ecf){_0x10f727=_0x1c8ecf;_0xf9229f[_0xeb4a('0x37')]=_[_0xeb4a('0x4b')](db[_0xeb4a('0x53')][_0xeb4a('0x33')]);_0xf9229f[_0xeb4a('0x38')]=_[_0xeb4a('0x4b')](_0x24332a['query']);_0xf9229f['filters']=_['intersection'](_0xf9229f['model'],_0xf9229f[_0xeb4a('0x38')]);_0x41c402[_0xeb4a('0x3b')]=_[_0xeb4a('0x3a')](_0xf9229f[_0xeb4a('0x37')],qs['fields'](_0x24332a['query'][_0xeb4a('0x3c')]));_0x41c402[_0xeb4a('0x3b')]=_0x41c402[_0xeb4a('0x3b')][_0xeb4a('0x4c')]?_0x41c402[_0xeb4a('0x3b')]:_0xf9229f['model'];_0x41c402[_0xeb4a('0x3f')]=qs['sort'](_0x24332a[_0xeb4a('0x38')][_0xeb4a('0x40')]);_0x41c402['where']=qs[_0xeb4a('0x39')](_['pick'](_0x24332a[_0xeb4a('0x38')],_0xf9229f[_0xeb4a('0x39')]));if(_0x24332a[_0xeb4a('0x38')][_0xeb4a('0x45')]){_0x41c402[_0xeb4a('0x41')]=_['merge'](_0x41c402['where'],{'$or':_[_0xeb4a('0x32')](_0x41c402[_0xeb4a('0x3b')],function(_0x1c1693){var _0x5204d9={};_0x5204d9[_0x1c1693]={'$like':'%'+_0x24332a[_0xeb4a('0x38')]['filter']+'%'};return _0x5204d9;})});}_0x41c402=_[_0xeb4a('0x43')]({},_0x41c402,_0x24332a[_0xeb4a('0x4d')]);return _0x10f727[_0xeb4a('0x54')](_0x41c402);}})[_0xeb4a('0x1c')](function(_0x4966ab){if(_0x4966ab){_0x847d33=_0x4966ab[_0xeb4a('0x4c')];if(!_0x24332a['query'][_0xeb4a('0x3d')](_0xeb4a('0x3e'))){_0x41c402[_0xeb4a('0x27')]=qs['limit'](_0x24332a[_0xeb4a('0x38')][_0xeb4a('0x27')]);_0x41c402[_0xeb4a('0x26')]=qs[_0xeb4a('0x26')](_0x24332a[_0xeb4a('0x38')][_0xeb4a('0x26')]);}return _0x10f727[_0xeb4a('0x54')](_0x41c402);}})['then'](function(_0x467d2d){if(_0x467d2d){return _0x467d2d?{'count':_0x847d33,'rows':_0x467d2d}:null;}})[_0xeb4a('0x1c')](respondWithResult(_0x157d07,null))['catch'](handleError(_0x157d07,null));};exports[_0xeb4a('0x55')]=function(_0x155067,_0x1b72ce,_0x542d66){if(_0x155067[_0xeb4a('0x51')]['id']){delete _0x155067[_0xeb4a('0x51')]['id'];}return db[_0xeb4a('0x46')][_0xeb4a('0x52')]({'where':{'id':_0x155067[_0xeb4a('0x50')]['id']}})[_0xeb4a('0x1c')](handleEntityNotFound(_0x1b72ce,null))[_0xeb4a('0x1c')](function(_0x2f26de){if(_0x2f26de){_0x155067[_0xeb4a('0x51')][_0xeb4a('0x56')]=_0x2f26de['id'];_0x155067['body'][_0xeb4a('0x57')]=integrations[_0xeb4a('0x58')](_0x155067['body'][_0xeb4a('0x59')],_0x155067[_0xeb4a('0x51')]['type']);_0x155067[_0xeb4a('0x51')][_0xeb4a('0x5a')]=integrations[_0xeb4a('0x5b')](_0x155067[_0xeb4a('0x51')]['channel'],_0x155067[_0xeb4a('0x51')][_0xeb4a('0x35')]);return db[_0xeb4a('0x53')][_0xeb4a('0x4f')](_0x155067[_0xeb4a('0x51')],{'include':[{'model':db[_0xeb4a('0x5c')],'as':_0xeb4a('0x57')},{'model':db[_0xeb4a('0x5c')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1b72ce,null))[_0xeb4a('0x23')](handleError(_0x1b72ce,null));};exports[_0xeb4a('0x5d')]=function(_0x516408,_0x4bb524,_0x1af697){var _0x528be8;var _0x55de64='';var _0x820d0e='Task';return db[_0xeb4a('0x46')][_0xeb4a('0x52')]({'where':{'id':_0x516408[_0xeb4a('0x50')]['id']},'attributes':['id',_0xeb4a('0x5e'),_0xeb4a('0x5f'),_0xeb4a('0x60'),_0xeb4a('0x61'),_0xeb4a('0x62'),_0xeb4a('0x63')]})['then'](handleEntityNotFound(_0x4bb524,null))[_0xeb4a('0x1c')](function(_0x5a5751){if(_0x5a5751){_0x55de64=_0x5a5751[_0xeb4a('0x5e')];var _0x14f8a5=_0x55de64['slice'](-0x1);if(_0x14f8a5==='/'){_0x55de64=_0x55de64['substring'](0x0,_0x55de64[_0xeb4a('0x64')](_0x14f8a5));}_0x528be8=new jsforce[(_0xeb4a('0x65'))]({'oauth2':{'loginUrl':_0x55de64,'clientId':_0x5a5751[_0xeb4a('0x5f')],'clientSecret':_0x5a5751['clientSecret']}});return _0x528be8[_0xeb4a('0x66')](_0x5a5751['username'],_0x5a5751[_0xeb4a('0x62')]['concat'](_0x5a5751['securityToken']));}})[_0xeb4a('0x1c')](function(_0x148b08){if(_0x148b08){if(!_[_0xeb4a('0x67')](_0x516408[_0xeb4a('0x38')][_0xeb4a('0x68')])){_0x820d0e=_0x516408[_0xeb4a('0x38')][_0xeb4a('0x68')];}return _0x528be8[_0xeb4a('0x69')](_0x820d0e)['describe']();}})[_0xeb4a('0x1c')](function(_0x5c507b){var _0x434763=[_0xeb4a('0x6a'),_0xeb4a('0x6b'),_0xeb4a('0x6c'),_0xeb4a('0x6d'),_0xeb4a('0x6e'),_0xeb4a('0x6f')];var _0x43db72=[_0xeb4a('0x70'),_0xeb4a('0x71'),'picklist',_0xeb4a('0x72'),_0xeb4a('0x73'),_0xeb4a('0x74'),_0xeb4a('0x75')];if(_0x5c507b){_['remove'](_0x5c507b[_0xeb4a('0x3c')],function(_0x16d897){return _0x434763[_0xeb4a('0x76')](_0x16d897['name'])||!_0x43db72[_0xeb4a('0x76')](_0x16d897[_0xeb4a('0x35')]);});return{'count':_0x5c507b['fields'][_0xeb4a('0x4c')],'rows':_['map'](_0x5c507b[_0xeb4a('0x3c')],function(_0x1857ef){return{'id':_0x1857ef[_0xeb4a('0x2f')],'name':_0x1857ef[_0xeb4a('0x77')],'custom':_0x1857ef[_0xeb4a('0x78')],'options':_0x1857ef[_0xeb4a('0x79')][_0xeb4a('0x4c')]>0x0?_[_0xeb4a('0x32')](_0x1857ef[_0xeb4a('0x79')],function(_0x39d4b6){return{'name':_0x39d4b6[_0xeb4a('0x77')],'value':_0x39d4b6[_0xeb4a('0x7a')]};}):_0x1857ef[_0xeb4a('0x35')]==_0xeb4a('0x72')?[{'name':'True','value':_0xeb4a('0x7b')},{'name':_0xeb4a('0x7c'),'value':_0xeb4a('0x7d')}]:[]};})};}})['then'](respondWithResult(_0x4bb524,null))[_0xeb4a('0x23')](function(_0xc40654){var _0x401643=_0x516408[_0xeb4a('0x38')][_0xeb4a('0x7e')]?0x1f4:_0xc40654[_0xeb4a('0x7f')]||0x1f4;logger[_0xeb4a('0x20')](_0xeb4a('0x80'),_0xeb4a('0x5d'),_0x401643,JSON[_0xeb4a('0x1f')](_0xc40654));delete _0xc40654[_0xeb4a('0x2f')];if(_0x401643===0x191){_0x401643=0x190;}_0x4bb524[_0xeb4a('0x28')](_0x401643)['send'](_0x516408['query'][_0xeb4a('0x7e')]?{'message':_0xeb4a('0x81'),'statusCode':_0xc40654[_0xeb4a('0x7f')]}:_0xc40654);});};
\ No newline at end of file