Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / intSalesforceConfiguration / intSalesforceConfiguration.controller.js
index f4c2542..7581a64 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd87d=['limit','set','Content-Range','apply','reject','save','update','destroy','then','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','SalesforceConfiguration','include','findAll','find','create','body','params','getFields','findOne','length','getSubjects','SalesforceField','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count'];(function(_0x1fd6b0,_0x5a40a0){var _0x202a08=function(_0x3a0674){while(--_0x3a0674){_0x1fd6b0['push'](_0x1fd6b0['shift']());}};_0x202a08(++_0x5a40a0);}(_0xd87d,0x19d));var _0xdd87=function(_0x263f85,_0xa94bec){_0x263f85=_0x263f85-0x0;var _0x58fc53=_0xd87d[_0x263f85];return _0x58fc53;};'use strict';var pdf=require(_0xdd87('0x0'));var emlformat=require(_0xdd87('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdd87('0x2'));var jsonpatch=require(_0xdd87('0x3'));var rp=require(_0xdd87('0x4'));var moment=require(_0xdd87('0x5'));var BPromise=require(_0xdd87('0x6'));var Mustache=require(_0xdd87('0x7'));var util=require('util');var path=require(_0xdd87('0x8'));var sox=require('sox');var csv=require(_0xdd87('0x9'));var ejs=require(_0xdd87('0xa'));var fs=require('fs');var _=require(_0xdd87('0xb'));var squel=require(_0xdd87('0xc'));var crypto=require(_0xdd87('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdd87('0xe'));var toCsv=require(_0xdd87('0x9'));var querystring=require('querystring');var Papa=require(_0xdd87('0xf'));var Redis=require(_0xdd87('0x10'));var authService=require(_0xdd87('0x11'));var qs=require(_0xdd87('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd87('0x13'));var logger=require('../../config/logger')(_0xdd87('0x14'));var utils=require(_0xdd87('0x15'));var config=require(_0xdd87('0x16'));var db=require(_0xdd87('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xdd87('0x18')][_0xdd87('0x19')]({'port':0x232a});function checkPasswordPattern(_0x491298,_0x3c7f3a,_0x22dff5){if(_0x22dff5){var _0x4b4683=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b4683[_0xdd87('0x1a')](_0x3c7f3a)){return _0x491298;}else{throw new db[(_0xdd87('0x1b'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x491298;}}function respondWithRpcPromise(_0x90234e,_0x230505,_0x53d45d,_0x4557fa){return new BPromise(function(_0x485dd5,_0x28c568){var _0x289010=_0x4557fa||client;return _0x289010['request'](_0x90234e,_0x53d45d)['then'](function(_0x47121e){logger[_0xdd87('0x1c')](_0xdd87('0x1d'),_0x230505,_0xdd87('0x1e'));logger[_0xdd87('0x1f')](_0xdd87('0x20'),_0x230505,_0xdd87('0x1e'),JSON[_0xdd87('0x21')](_0x47121e));if(_0x47121e[_0xdd87('0x22')]){if(_0x47121e['error']['code']===0x1f4){logger[_0xdd87('0x22')](_0xdd87('0x1d'),_0x230505,_0x47121e[_0xdd87('0x22')][_0xdd87('0x23')]);return _0x28c568(_0x47121e[_0xdd87('0x22')][_0xdd87('0x23')]);}logger[_0xdd87('0x22')](_0xdd87('0x1d'),_0x230505,_0x47121e[_0xdd87('0x22')]['message']);return _0x485dd5(_0x47121e[_0xdd87('0x22')][_0xdd87('0x23')]);}else{logger[_0xdd87('0x1c')]('SalesforceConfiguration,\x20%s,\x20%s',_0x230505,'request\x20sent');_0x485dd5(_0x47121e[_0xdd87('0x24')]['message']);}})[_0xdd87('0x25')](function(_0x221e8a){logger[_0xdd87('0x22')](_0xdd87('0x1d'),_0x230505,_0x221e8a);_0x28c568(_0x221e8a);});});}function respondWithStatusCode(_0xd6c555,_0x5fbc34){_0x5fbc34=_0x5fbc34||0xcc;return function(_0x1c5406){if(_0x1c5406){return _0xd6c555[_0xdd87('0x26')](_0x5fbc34);}return _0xd6c555[_0xdd87('0x27')](_0x5fbc34)['end']();};}function respondWithResult(_0x5a1c59,_0x3107db){_0x3107db=_0x3107db||0xc8;return function(_0xc3c420){if(_0xc3c420){return _0x5a1c59['status'](_0x3107db)[_0xdd87('0x28')](_0xc3c420);}};}function respondWithFilteredResult(_0x3deaf1,_0x4bb369){return function(_0x1cde2e){if(_0x1cde2e){var _0x26d759=_0x1cde2e[_0xdd87('0x29')],_0x3ef17b=_0x4bb369['offset'],_0x512e90=_0x4bb369['offset']+_0x4bb369[_0xdd87('0x2a')],_0x4ae397;if(_0x512e90>=_0x26d759){_0x512e90=_0x26d759;_0x4ae397=0xc8;}else{_0x4ae397=0xce;}_0x3deaf1[_0xdd87('0x27')](_0x4ae397);return _0x3deaf1[_0xdd87('0x2b')](_0xdd87('0x2c'),_0x3ef17b+'-'+_0x512e90+'/'+_0x26d759)[_0xdd87('0x28')](_0x1cde2e);}return null;};}function patchUpdates(_0x251798){return function(_0x4d3d36){try{jsonpatch[_0xdd87('0x2d')](_0x4d3d36,_0x251798,!![]);}catch(_0x39c302){return BPromise[_0xdd87('0x2e')](_0x39c302);}return _0x4d3d36[_0xdd87('0x2f')]();};}function saveUpdates(_0x336655,_0x1eddb9){return function(_0x3f4773){if(_0x3f4773){return _0x3f4773[_0xdd87('0x30')](_0x336655)['then'](function(_0x3a22f9){return _0x3a22f9;});}return null;};}function removeEntity(_0x15d424,_0x741876){return function(_0x311ec5){if(_0x311ec5){return _0x311ec5[_0xdd87('0x31')]()[_0xdd87('0x32')](function(){_0x15d424['status'](0xcc)[_0xdd87('0x33')]();});}};}function handleEntityNotFound(_0x21e431,_0x12fcb2){return function(_0x18c543){if(!_0x18c543){_0x21e431[_0xdd87('0x26')](0x194);}return _0x18c543;};}function handleError(_0x27af3a,_0x439b11){_0x439b11=_0x439b11||0x1f4;return function(_0x3ecd54){logger[_0xdd87('0x22')](_0x3ecd54['stack']);if(_0x3ecd54[_0xdd87('0x34')]){delete _0x3ecd54[_0xdd87('0x34')];}_0x27af3a[_0xdd87('0x27')](_0x439b11)[_0xdd87('0x35')](_0x3ecd54);};}exports[_0xdd87('0x36')]=function(_0x5e264a,_0x4e2348){var _0x80fa1b={},_0x1bd39d={},_0xdbba32={'count':0x0,'rows':[]};var _0xc00a63=_[_0xdd87('0x37')](db['SalesforceConfiguration'][_0xdd87('0x38')],function(_0x41536a){return{'name':_0x41536a[_0xdd87('0x39')],'type':_0x41536a[_0xdd87('0x3a')][_0xdd87('0x3b')]};});_0x1bd39d[_0xdd87('0x3c')]=_['map'](_0xc00a63,'name');_0x1bd39d[_0xdd87('0x3d')]=_[_0xdd87('0x3e')](_0x5e264a[_0xdd87('0x3d')]);_0x1bd39d[_0xdd87('0x3f')]=_[_0xdd87('0x40')](_0x1bd39d[_0xdd87('0x3c')],_0x1bd39d[_0xdd87('0x3d')]);_0x80fa1b[_0xdd87('0x41')]=_[_0xdd87('0x40')](_0x1bd39d['model'],qs['fields'](_0x5e264a[_0xdd87('0x3d')][_0xdd87('0x42')]));_0x80fa1b[_0xdd87('0x41')]=_0x80fa1b[_0xdd87('0x41')]['length']?_0x80fa1b['attributes']:_0x1bd39d['model'];if(!_0x5e264a['query'][_0xdd87('0x43')](_0xdd87('0x44'))){_0x80fa1b[_0xdd87('0x2a')]=qs[_0xdd87('0x2a')](_0x5e264a[_0xdd87('0x3d')][_0xdd87('0x2a')]);_0x80fa1b[_0xdd87('0x45')]=qs['offset'](_0x5e264a[_0xdd87('0x3d')][_0xdd87('0x45')]);}_0x80fa1b[_0xdd87('0x46')]=qs[_0xdd87('0x47')](_0x5e264a[_0xdd87('0x3d')]['sort']);_0x80fa1b['where']=qs[_0xdd87('0x3f')](_[_0xdd87('0x48')](_0x5e264a[_0xdd87('0x3d')],_0x1bd39d[_0xdd87('0x3f')]),_0xc00a63);if(_0x5e264a['query'][_0xdd87('0x49')]){_0x80fa1b[_0xdd87('0x4a')]=_['merge'](_0x80fa1b[_0xdd87('0x4a')],{'$or':_[_0xdd87('0x37')](_0xc00a63,function(_0x249374){if(_0x249374[_0xdd87('0x3a')]!==_0xdd87('0x4b')){var _0x144755={};_0x144755[_0x249374[_0xdd87('0x34')]]={'$like':'%'+_0x5e264a[_0xdd87('0x3d')][_0xdd87('0x49')]+'%'};return _0x144755;}})});}_0x80fa1b=_[_0xdd87('0x4c')]({},_0x80fa1b,_0x5e264a[_0xdd87('0x4d')]);var _0x2f92c1={'where':_0x80fa1b[_0xdd87('0x4a')]};return db[_0xdd87('0x4e')]['count'](_0x2f92c1)[_0xdd87('0x32')](function(_0x442ede){_0xdbba32[_0xdd87('0x29')]=_0x442ede;if(_0x5e264a[_0xdd87('0x3d')]['includeAll']){_0x80fa1b[_0xdd87('0x4f')]=[{'all':!![]}];}return db[_0xdd87('0x4e')][_0xdd87('0x50')](_0x80fa1b);})['then'](function(_0x1d0c44){_0xdbba32['rows']=_0x1d0c44;return _0xdbba32;})[_0xdd87('0x32')](respondWithFilteredResult(_0x4e2348,_0x80fa1b))['catch'](handleError(_0x4e2348,null));};exports['show']=function(_0xb5601d,_0x30284e){var _0x4e4082={'raw':![],'where':{'id':_0xb5601d['params']['id']}},_0x20f868={};_0x20f868['model']=_[_0xdd87('0x3e')](db[_0xdd87('0x4e')][_0xdd87('0x38')]);_0x20f868['query']=_[_0xdd87('0x3e')](_0xb5601d['query']);_0x20f868[_0xdd87('0x3f')]=_[_0xdd87('0x40')](_0x20f868['model'],_0x20f868[_0xdd87('0x3d')]);_0x4e4082[_0xdd87('0x41')]=_[_0xdd87('0x40')](_0x20f868['model'],qs[_0xdd87('0x42')](_0xb5601d[_0xdd87('0x3d')][_0xdd87('0x42')]));_0x4e4082['attributes']=_0x4e4082['attributes']['length']?_0x4e4082[_0xdd87('0x41')]:_0x20f868[_0xdd87('0x3c')];if(_0xb5601d[_0xdd87('0x3d')]['includeAll']){_0x4e4082[_0xdd87('0x4f')]=[{'all':!![]}];}_0x4e4082=_[_0xdd87('0x4c')]({},_0x4e4082,_0xb5601d['options']);return db[_0xdd87('0x4e')][_0xdd87('0x51')](_0x4e4082)[_0xdd87('0x32')](handleEntityNotFound(_0x30284e,null))[_0xdd87('0x32')](respondWithResult(_0x30284e,null))[_0xdd87('0x25')](handleError(_0x30284e,null));};exports[_0xdd87('0x52')]=function(_0x33b184,_0xd5de82){return db[_0xdd87('0x4e')]['create'](_0x33b184['body'],{})[_0xdd87('0x32')](respondWithResult(_0xd5de82,0xc9))[_0xdd87('0x25')](handleError(_0xd5de82,null));};exports['update']=function(_0x4edada,_0x55ffb8){if(_0x4edada[_0xdd87('0x53')]['id']){delete _0x4edada[_0xdd87('0x53')]['id'];}return db[_0xdd87('0x4e')]['find']({'where':{'id':_0x4edada['params']['id']}})[_0xdd87('0x32')](handleEntityNotFound(_0x55ffb8,null))[_0xdd87('0x32')](saveUpdates(_0x4edada[_0xdd87('0x53')],null))['then'](respondWithResult(_0x55ffb8,null))[_0xdd87('0x25')](handleError(_0x55ffb8,null));};exports['destroy']=function(_0x1de824,_0x4ebfbb){return db[_0xdd87('0x4e')][_0xdd87('0x51')]({'where':{'id':_0x1de824[_0xdd87('0x54')]['id']}})[_0xdd87('0x32')](handleEntityNotFound(_0x4ebfbb,null))['then'](removeEntity(_0x4ebfbb,null))['catch'](handleError(_0x4ebfbb,null));};exports[_0xdd87('0x55')]=function(_0x7b7410,_0x47a4a0,_0x11e568){var _0x18f256={};var _0x5ac664={};var _0x2680fe;var _0x4b6f3c;return db[_0xdd87('0x4e')][_0xdd87('0x56')]({'where':{'id':_0x7b7410[_0xdd87('0x54')]['id']}})[_0xdd87('0x32')](handleEntityNotFound(_0x47a4a0,null))['then'](function(_0x318851){if(_0x318851){_0x2680fe=_0x318851;_0x5ac664[_0xdd87('0x3c')]=_[_0xdd87('0x3e')](db['SalesforceField'][_0xdd87('0x38')]);_0x5ac664[_0xdd87('0x3d')]=_[_0xdd87('0x3e')](_0x7b7410[_0xdd87('0x3d')]);_0x5ac664['filters']=_[_0xdd87('0x40')](_0x5ac664[_0xdd87('0x3c')],_0x5ac664[_0xdd87('0x3d')]);_0x18f256['attributes']=_['intersection'](_0x5ac664[_0xdd87('0x3c')],qs['fields'](_0x7b7410[_0xdd87('0x3d')][_0xdd87('0x42')]));_0x18f256[_0xdd87('0x41')]=_0x18f256[_0xdd87('0x41')][_0xdd87('0x57')]?_0x18f256[_0xdd87('0x41')]:_0x5ac664[_0xdd87('0x3c')];_0x18f256[_0xdd87('0x46')]=qs['sort'](_0x7b7410[_0xdd87('0x3d')][_0xdd87('0x47')]);_0x18f256['where']=qs[_0xdd87('0x3f')](_[_0xdd87('0x48')](_0x7b7410['query'],_0x5ac664['filters']));if(_0x7b7410[_0xdd87('0x3d')][_0xdd87('0x49')]){_0x18f256[_0xdd87('0x4a')]=_[_0xdd87('0x4c')](_0x18f256[_0xdd87('0x4a')],{'$or':_[_0xdd87('0x37')](_0x18f256[_0xdd87('0x41')],function(_0x3781b9){var _0x3cc0b0={};_0x3cc0b0[_0x3781b9]={'$like':'%'+_0x7b7410[_0xdd87('0x3d')][_0xdd87('0x49')]+'%'};return _0x3cc0b0;})});}_0x18f256=_[_0xdd87('0x4c')]({},_0x18f256,_0x7b7410[_0xdd87('0x4d')]);return _0x2680fe['getFields'](_0x18f256);}})[_0xdd87('0x32')](function(_0xd4574e){if(_0xd4574e){_0x4b6f3c=_0xd4574e[_0xdd87('0x57')];if(!_0x7b7410[_0xdd87('0x3d')]['hasOwnProperty']('nolimit')){_0x18f256[_0xdd87('0x2a')]=qs['limit'](_0x7b7410['query'][_0xdd87('0x2a')]);_0x18f256[_0xdd87('0x45')]=qs['offset'](_0x7b7410[_0xdd87('0x3d')][_0xdd87('0x45')]);}return _0x2680fe[_0xdd87('0x55')](_0x18f256);}})[_0xdd87('0x32')](function(_0x3f35c7){if(_0x3f35c7){return _0x3f35c7?{'count':_0x4b6f3c,'rows':_0x3f35c7}:null;}})[_0xdd87('0x32')](respondWithResult(_0x47a4a0,null))[_0xdd87('0x25')](handleError(_0x47a4a0,null));};exports[_0xdd87('0x58')]=function(_0x5406ca,_0x4ccbe4,_0xcbc908){var _0x26a7d4={};var _0x4a9f52={};var _0x43986d;var _0x5ceba8;return db[_0xdd87('0x4e')][_0xdd87('0x56')]({'where':{'id':_0x5406ca[_0xdd87('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ccbe4,null))['then'](function(_0x1cc1ab){if(_0x1cc1ab){_0x43986d=_0x1cc1ab;_0x4a9f52[_0xdd87('0x3c')]=_['keys'](db[_0xdd87('0x59')]['rawAttributes']);_0x4a9f52[_0xdd87('0x3d')]=_[_0xdd87('0x3e')](_0x5406ca[_0xdd87('0x3d')]);_0x4a9f52[_0xdd87('0x3f')]=_[_0xdd87('0x40')](_0x4a9f52[_0xdd87('0x3c')],_0x4a9f52[_0xdd87('0x3d')]);_0x26a7d4[_0xdd87('0x41')]=_[_0xdd87('0x40')](_0x4a9f52['model'],qs[_0xdd87('0x42')](_0x5406ca[_0xdd87('0x3d')][_0xdd87('0x42')]));_0x26a7d4[_0xdd87('0x41')]=_0x26a7d4[_0xdd87('0x41')]['length']?_0x26a7d4[_0xdd87('0x41')]:_0x4a9f52[_0xdd87('0x3c')];_0x26a7d4[_0xdd87('0x46')]=qs['sort'](_0x5406ca[_0xdd87('0x3d')][_0xdd87('0x47')]);_0x26a7d4[_0xdd87('0x4a')]=qs['filters'](_[_0xdd87('0x48')](_0x5406ca[_0xdd87('0x3d')],_0x4a9f52['filters']));if(_0x5406ca[_0xdd87('0x3d')][_0xdd87('0x49')]){_0x26a7d4[_0xdd87('0x4a')]=_[_0xdd87('0x4c')](_0x26a7d4[_0xdd87('0x4a')],{'$or':_[_0xdd87('0x37')](_0x26a7d4[_0xdd87('0x41')],function(_0x155b9f){var _0x31e93a={};_0x31e93a[_0x155b9f]={'$like':'%'+_0x5406ca[_0xdd87('0x3d')][_0xdd87('0x49')]+'%'};return _0x31e93a;})});}_0x26a7d4=_[_0xdd87('0x4c')]({},_0x26a7d4,_0x5406ca['options']);return _0x43986d['getSubjects'](_0x26a7d4);}})[_0xdd87('0x32')](function(_0x50aa9c){if(_0x50aa9c){_0x5ceba8=_0x50aa9c['length'];if(!_0x5406ca[_0xdd87('0x3d')][_0xdd87('0x43')](_0xdd87('0x44'))){_0x26a7d4[_0xdd87('0x2a')]=qs[_0xdd87('0x2a')](_0x5406ca['query'][_0xdd87('0x2a')]);_0x26a7d4[_0xdd87('0x45')]=qs[_0xdd87('0x45')](_0x5406ca[_0xdd87('0x3d')][_0xdd87('0x45')]);}return _0x43986d['getSubjects'](_0x26a7d4);}})['then'](function(_0x599bd5){if(_0x599bd5){return _0x599bd5?{'count':_0x5ceba8,'rows':_0x599bd5}:null;}})[_0xdd87('0x32')](respondWithResult(_0x4ccbe4,null))[_0xdd87('0x25')](handleError(_0x4ccbe4,null));};exports['getDescriptions']=function(_0x128442,_0x47b53e,_0x27d00e){var _0x56ba54={};var _0xbf0010={};var _0x1cc3f6;var _0x54bcd0;return db[_0xdd87('0x4e')][_0xdd87('0x56')]({'where':{'id':_0x128442[_0xdd87('0x54')]['id']}})[_0xdd87('0x32')](handleEntityNotFound(_0x47b53e,null))['then'](function(_0x171b41){if(_0x171b41){_0x1cc3f6=_0x171b41;_0xbf0010[_0xdd87('0x3c')]=_[_0xdd87('0x3e')](db['SalesforceField'][_0xdd87('0x38')]);_0xbf0010[_0xdd87('0x3d')]=_[_0xdd87('0x3e')](_0x128442['query']);_0xbf0010[_0xdd87('0x3f')]=_['intersection'](_0xbf0010[_0xdd87('0x3c')],_0xbf0010[_0xdd87('0x3d')]);_0x56ba54[_0xdd87('0x41')]=_[_0xdd87('0x40')](_0xbf0010[_0xdd87('0x3c')],qs[_0xdd87('0x42')](_0x128442['query']['fields']));_0x56ba54['attributes']=_0x56ba54[_0xdd87('0x41')][_0xdd87('0x57')]?_0x56ba54[_0xdd87('0x41')]:_0xbf0010[_0xdd87('0x3c')];_0x56ba54[_0xdd87('0x46')]=qs[_0xdd87('0x47')](_0x128442[_0xdd87('0x3d')]['sort']);_0x56ba54[_0xdd87('0x4a')]=qs[_0xdd87('0x3f')](_['pick'](_0x128442[_0xdd87('0x3d')],_0xbf0010[_0xdd87('0x3f')]));if(_0x128442[_0xdd87('0x3d')]['filter']){_0x56ba54['where']=_['merge'](_0x56ba54[_0xdd87('0x4a')],{'$or':_[_0xdd87('0x37')](_0x56ba54['attributes'],function(_0x43852f){var _0x689b14={};_0x689b14[_0x43852f]={'$like':'%'+_0x128442[_0xdd87('0x3d')]['filter']+'%'};return _0x689b14;})});}_0x56ba54=_['merge']({},_0x56ba54,_0x128442['options']);return _0x1cc3f6[_0xdd87('0x5a')](_0x56ba54);}})[_0xdd87('0x32')](function(_0x477cc8){if(_0x477cc8){_0x54bcd0=_0x477cc8[_0xdd87('0x57')];if(!_0x128442['query'][_0xdd87('0x43')](_0xdd87('0x44'))){_0x56ba54[_0xdd87('0x2a')]=qs['limit'](_0x128442[_0xdd87('0x3d')][_0xdd87('0x2a')]);_0x56ba54['offset']=qs[_0xdd87('0x45')](_0x128442[_0xdd87('0x3d')][_0xdd87('0x45')]);}return _0x1cc3f6[_0xdd87('0x5a')](_0x56ba54);}})[_0xdd87('0x32')](function(_0x3096f3){if(_0x3096f3){return _0x3096f3?{'count':_0x54bcd0,'rows':_0x3096f3}:null;}})[_0xdd87('0x32')](respondWithResult(_0x47b53e,null))['catch'](handleError(_0x47b53e,null));};
\ No newline at end of file
+var _0x37de=['filters','intersection','fields','query','attributes','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','getSubjects','SalesforceField','pick','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x37de,0x10f));var _0xe37d=function(_0x263cb4,_0x53ce57){_0x263cb4=_0x263cb4-0x0;var _0x32a04b=_0x37de[_0x263cb4];return _0x32a04b;};'use strict';var emlformat=require(_0xe37d('0x0'));var rimraf=require(_0xe37d('0x1'));var zipdir=require(_0xe37d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe37d('0x3'));var moment=require(_0xe37d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe37d('0x5'));var util=require('util');var path=require(_0xe37d('0x6'));var sox=require(_0xe37d('0x7'));var csv=require(_0xe37d('0x8'));var ejs=require(_0xe37d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe37d('0xa'));var crypto=require(_0xe37d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe37d('0xc'));var toCsv=require(_0xe37d('0x8'));var querystring=require(_0xe37d('0xd'));var Papa=require(_0xe37d('0xe'));var Redis=require(_0xe37d('0xf'));var authService=require(_0xe37d('0x10'));var qs=require(_0xe37d('0x11'));var as=require(_0xe37d('0x12'));var hardwareService=require(_0xe37d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe37d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe37d('0x15'));var db=require(_0xe37d('0x16'))['db'];function respondWithStatusCode(_0x262cca,_0x184120){_0x184120=_0x184120||0xcc;return function(_0x5dee3c){if(_0x5dee3c){return _0x262cca['sendStatus'](_0x184120);}return _0x262cca[_0xe37d('0x17')](_0x184120)['end']();};}function respondWithResult(_0x21b22a,_0x551811){_0x551811=_0x551811||0xc8;return function(_0x2e5304){if(_0x2e5304){return _0x21b22a[_0xe37d('0x17')](_0x551811)[_0xe37d('0x18')](_0x2e5304);}};}function respondWithFilteredResult(_0x16b925,_0x41584f){return function(_0x2e2728){if(_0x2e2728){var _0x1bff73=typeof _0x41584f[_0xe37d('0x19')]==='undefined'&&typeof _0x41584f[_0xe37d('0x1a')]===_0xe37d('0x1b');var _0x44422c=_0x2e2728['count'];var _0x2dcb70=_0x1bff73?0x0:_0x41584f[_0xe37d('0x19')];var _0x1f8964=_0x1bff73?_0x2e2728[_0xe37d('0x1c')]:_0x41584f['offset']+_0x41584f[_0xe37d('0x1a')];var _0x28ae1e;if(_0x1f8964>=_0x44422c){_0x1f8964=_0x44422c;_0x28ae1e=0xc8;}else{_0x28ae1e=0xce;}_0x16b925[_0xe37d('0x17')](_0x28ae1e);return _0x16b925[_0xe37d('0x1d')](_0xe37d('0x1e'),_0x2dcb70+'-'+_0x1f8964+'/'+_0x44422c)['json'](_0x2e2728);}return null;};}function patchUpdates(_0x3be3ad){return function(_0x9adb81){try{jsonpatch[_0xe37d('0x1f')](_0x9adb81,_0x3be3ad,!![]);}catch(_0x5eac6f){return BPromise[_0xe37d('0x20')](_0x5eac6f);}return _0x9adb81['save']();};}function saveUpdates(_0x2744eb,_0x46e295){return function(_0x1f949a){if(_0x1f949a){return _0x1f949a[_0xe37d('0x21')](_0x2744eb)['then'](function(_0x90bb9d){return _0x90bb9d;});}return null;};}function removeEntity(_0xb17327,_0x15ef7e){return function(_0x41ea11){if(_0x41ea11){return _0x41ea11[_0xe37d('0x22')]()[_0xe37d('0x23')](function(){_0xb17327[_0xe37d('0x17')](0xcc)[_0xe37d('0x24')]();});}};}function handleEntityNotFound(_0x558bc3,_0x1e9276){return function(_0x2ae185){if(!_0x2ae185){_0x558bc3['sendStatus'](0x194);}return _0x2ae185;};}function handleError(_0x44381e,_0x6c86b2){_0x6c86b2=_0x6c86b2||0x1f4;return function(_0xec276c){logger[_0xe37d('0x25')](_0xec276c[_0xe37d('0x26')]);if(_0xec276c['name']){delete _0xec276c[_0xe37d('0x27')];}_0x44381e[_0xe37d('0x17')](_0x6c86b2)[_0xe37d('0x28')](_0xec276c);};}exports['index']=function(_0x47fe4f,_0x59fb45){var _0x54e0f6={},_0x435bca={},_0x3d051f={'count':0x0,'rows':[]};var _0x4372be=_[_0xe37d('0x29')](db[_0xe37d('0x2a')][_0xe37d('0x2b')],function(_0x14383f){return{'name':_0x14383f[_0xe37d('0x2c')],'type':_0x14383f[_0xe37d('0x2d')][_0xe37d('0x2e')]};});_0x435bca[_0xe37d('0x2f')]=_[_0xe37d('0x29')](_0x4372be,_0xe37d('0x27'));_0x435bca['query']=_[_0xe37d('0x30')](_0x47fe4f['query']);_0x435bca[_0xe37d('0x31')]=_[_0xe37d('0x32')](_0x435bca[_0xe37d('0x2f')],_0x435bca['query']);_0x54e0f6['attributes']=_['intersection'](_0x435bca['model'],qs[_0xe37d('0x33')](_0x47fe4f[_0xe37d('0x34')][_0xe37d('0x33')]));_0x54e0f6[_0xe37d('0x35')]=_0x54e0f6['attributes']['length']?_0x54e0f6[_0xe37d('0x35')]:_0x435bca[_0xe37d('0x2f')];if(!_0x47fe4f['query'][_0xe37d('0x36')](_0xe37d('0x37'))){_0x54e0f6[_0xe37d('0x1a')]=qs[_0xe37d('0x1a')](_0x47fe4f[_0xe37d('0x34')][_0xe37d('0x1a')]);_0x54e0f6[_0xe37d('0x19')]=qs[_0xe37d('0x19')](_0x47fe4f['query'][_0xe37d('0x19')]);}_0x54e0f6[_0xe37d('0x38')]=qs[_0xe37d('0x39')](_0x47fe4f[_0xe37d('0x34')][_0xe37d('0x39')]);_0x54e0f6['where']=qs['filters'](_['pick'](_0x47fe4f[_0xe37d('0x34')],_0x435bca[_0xe37d('0x31')]),_0x4372be);if(_0x47fe4f[_0xe37d('0x34')][_0xe37d('0x3a')]){_0x54e0f6[_0xe37d('0x3b')]=_['merge'](_0x54e0f6[_0xe37d('0x3b')],{'$or':_[_0xe37d('0x29')](_0x4372be,function(_0x3cc437){if(_0x3cc437[_0xe37d('0x2d')]!==_0xe37d('0x3c')){var _0x2f75ac={};_0x2f75ac[_0x3cc437['name']]={'$like':'%'+_0x47fe4f[_0xe37d('0x34')][_0xe37d('0x3a')]+'%'};return _0x2f75ac;}})});}_0x54e0f6=_[_0xe37d('0x3d')]({},_0x54e0f6,_0x47fe4f[_0xe37d('0x3e')]);var _0x2dd724={'where':_0x54e0f6[_0xe37d('0x3b')]};return db[_0xe37d('0x2a')][_0xe37d('0x1c')](_0x2dd724)['then'](function(_0x5a392e){_0x3d051f[_0xe37d('0x1c')]=_0x5a392e;if(_0x47fe4f[_0xe37d('0x34')][_0xe37d('0x3f')]){_0x54e0f6[_0xe37d('0x40')]=[{'all':!![]}];}return db[_0xe37d('0x2a')][_0xe37d('0x41')](_0x54e0f6);})['then'](function(_0x332557){_0x3d051f[_0xe37d('0x42')]=_0x332557;return _0x3d051f;})[_0xe37d('0x23')](respondWithFilteredResult(_0x59fb45,_0x54e0f6))[_0xe37d('0x43')](handleError(_0x59fb45,null));};exports[_0xe37d('0x44')]=function(_0x5c3772,_0xa68aea){var _0x3033c6={'raw':![],'where':{'id':_0x5c3772[_0xe37d('0x45')]['id']}},_0x22bb11={};_0x22bb11[_0xe37d('0x2f')]=_[_0xe37d('0x30')](db[_0xe37d('0x2a')]['rawAttributes']);_0x22bb11['query']=_[_0xe37d('0x30')](_0x5c3772['query']);_0x22bb11[_0xe37d('0x31')]=_[_0xe37d('0x32')](_0x22bb11['model'],_0x22bb11[_0xe37d('0x34')]);_0x3033c6[_0xe37d('0x35')]=_[_0xe37d('0x32')](_0x22bb11['model'],qs[_0xe37d('0x33')](_0x5c3772[_0xe37d('0x34')][_0xe37d('0x33')]));_0x3033c6[_0xe37d('0x35')]=_0x3033c6[_0xe37d('0x35')][_0xe37d('0x46')]?_0x3033c6[_0xe37d('0x35')]:_0x22bb11[_0xe37d('0x2f')];if(_0x5c3772[_0xe37d('0x34')][_0xe37d('0x3f')]){_0x3033c6[_0xe37d('0x40')]=[{'all':!![]}];}_0x3033c6=_['merge']({},_0x3033c6,_0x5c3772['options']);return db[_0xe37d('0x2a')][_0xe37d('0x47')](_0x3033c6)[_0xe37d('0x23')](handleEntityNotFound(_0xa68aea,null))['then'](respondWithResult(_0xa68aea,null))[_0xe37d('0x43')](handleError(_0xa68aea,null));};exports['create']=function(_0x449211,_0x1d8f8d){return db[_0xe37d('0x2a')][_0xe37d('0x48')](_0x449211[_0xe37d('0x49')],{})[_0xe37d('0x23')](respondWithResult(_0x1d8f8d,0xc9))[_0xe37d('0x43')](handleError(_0x1d8f8d,null));};exports['update']=function(_0x20e372,_0x19c987){if(_0x20e372[_0xe37d('0x49')]['id']){delete _0x20e372[_0xe37d('0x49')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x20e372[_0xe37d('0x45')]['id']}})[_0xe37d('0x23')](handleEntityNotFound(_0x19c987,null))['then'](saveUpdates(_0x20e372[_0xe37d('0x49')],null))[_0xe37d('0x23')](respondWithResult(_0x19c987,null))[_0xe37d('0x43')](handleError(_0x19c987,null));};exports[_0xe37d('0x22')]=function(_0x33d9c3,_0x455528){return db['SalesforceConfiguration']['find']({'where':{'id':_0x33d9c3[_0xe37d('0x45')]['id']}})[_0xe37d('0x23')](handleEntityNotFound(_0x455528,null))[_0xe37d('0x23')](removeEntity(_0x455528,null))['catch'](handleError(_0x455528,null));};exports[_0xe37d('0x4a')]=function(_0x3deb59,_0x37050b,_0x105893){var _0x7c1f6b={};var _0x323956={};var _0x2b26bb;var _0x267a9f;return db['SalesforceConfiguration'][_0xe37d('0x4b')]({'where':{'id':_0x3deb59['params']['id']}})['then'](handleEntityNotFound(_0x37050b,null))[_0xe37d('0x23')](function(_0x4f9eb6){if(_0x4f9eb6){_0x2b26bb=_0x4f9eb6;_0x323956[_0xe37d('0x2f')]=_[_0xe37d('0x30')](db['SalesforceField'][_0xe37d('0x2b')]);_0x323956[_0xe37d('0x34')]=_['keys'](_0x3deb59[_0xe37d('0x34')]);_0x323956['filters']=_[_0xe37d('0x32')](_0x323956[_0xe37d('0x2f')],_0x323956[_0xe37d('0x34')]);_0x7c1f6b[_0xe37d('0x35')]=_[_0xe37d('0x32')](_0x323956[_0xe37d('0x2f')],qs['fields'](_0x3deb59[_0xe37d('0x34')][_0xe37d('0x33')]));_0x7c1f6b[_0xe37d('0x35')]=_0x7c1f6b[_0xe37d('0x35')]['length']?_0x7c1f6b[_0xe37d('0x35')]:_0x323956['model'];_0x7c1f6b[_0xe37d('0x38')]=qs['sort'](_0x3deb59[_0xe37d('0x34')]['sort']);_0x7c1f6b[_0xe37d('0x3b')]=qs['filters'](_['pick'](_0x3deb59['query'],_0x323956[_0xe37d('0x31')]));if(_0x3deb59[_0xe37d('0x34')][_0xe37d('0x3a')]){_0x7c1f6b[_0xe37d('0x3b')]=_[_0xe37d('0x3d')](_0x7c1f6b[_0xe37d('0x3b')],{'$or':_['map'](_0x7c1f6b[_0xe37d('0x35')],function(_0x2ceb4d){var _0x3b14af={};_0x3b14af[_0x2ceb4d]={'$like':'%'+_0x3deb59[_0xe37d('0x34')][_0xe37d('0x3a')]+'%'};return _0x3b14af;})});}_0x7c1f6b=_['merge']({},_0x7c1f6b,_0x3deb59['options']);return _0x2b26bb[_0xe37d('0x4a')](_0x7c1f6b);}})['then'](function(_0x495387){if(_0x495387){_0x267a9f=_0x495387[_0xe37d('0x46')];if(!_0x3deb59['query'][_0xe37d('0x36')](_0xe37d('0x37'))){_0x7c1f6b[_0xe37d('0x1a')]=qs['limit'](_0x3deb59[_0xe37d('0x34')][_0xe37d('0x1a')]);_0x7c1f6b[_0xe37d('0x19')]=qs['offset'](_0x3deb59[_0xe37d('0x34')][_0xe37d('0x19')]);}return _0x2b26bb['getFields'](_0x7c1f6b);}})[_0xe37d('0x23')](function(_0x410145){if(_0x410145){return _0x410145?{'count':_0x267a9f,'rows':_0x410145}:null;}})[_0xe37d('0x23')](respondWithResult(_0x37050b,null))[_0xe37d('0x43')](handleError(_0x37050b,null));};exports[_0xe37d('0x4c')]=function(_0x42d72e,_0x19092a,_0x5926ad){var _0x6d7580={};var _0x1b33cf={};var _0x2d8e3c;var _0x43833e;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x42d72e[_0xe37d('0x45')]['id']}})[_0xe37d('0x23')](handleEntityNotFound(_0x19092a,null))[_0xe37d('0x23')](function(_0x3fe710){if(_0x3fe710){_0x2d8e3c=_0x3fe710;_0x1b33cf[_0xe37d('0x2f')]=_[_0xe37d('0x30')](db[_0xe37d('0x4d')][_0xe37d('0x2b')]);_0x1b33cf[_0xe37d('0x34')]=_[_0xe37d('0x30')](_0x42d72e[_0xe37d('0x34')]);_0x1b33cf['filters']=_[_0xe37d('0x32')](_0x1b33cf[_0xe37d('0x2f')],_0x1b33cf[_0xe37d('0x34')]);_0x6d7580[_0xe37d('0x35')]=_[_0xe37d('0x32')](_0x1b33cf[_0xe37d('0x2f')],qs[_0xe37d('0x33')](_0x42d72e[_0xe37d('0x34')]['fields']));_0x6d7580[_0xe37d('0x35')]=_0x6d7580[_0xe37d('0x35')][_0xe37d('0x46')]?_0x6d7580[_0xe37d('0x35')]:_0x1b33cf[_0xe37d('0x2f')];_0x6d7580['order']=qs[_0xe37d('0x39')](_0x42d72e[_0xe37d('0x34')]['sort']);_0x6d7580[_0xe37d('0x3b')]=qs['filters'](_[_0xe37d('0x4e')](_0x42d72e[_0xe37d('0x34')],_0x1b33cf[_0xe37d('0x31')]));if(_0x42d72e[_0xe37d('0x34')]['filter']){_0x6d7580['where']=_[_0xe37d('0x3d')](_0x6d7580[_0xe37d('0x3b')],{'$or':_[_0xe37d('0x29')](_0x6d7580[_0xe37d('0x35')],function(_0x177013){var _0x3dd7af={};_0x3dd7af[_0x177013]={'$like':'%'+_0x42d72e[_0xe37d('0x34')][_0xe37d('0x3a')]+'%'};return _0x3dd7af;})});}_0x6d7580=_['merge']({},_0x6d7580,_0x42d72e['options']);return _0x2d8e3c[_0xe37d('0x4c')](_0x6d7580);}})['then'](function(_0x1573d8){if(_0x1573d8){_0x43833e=_0x1573d8[_0xe37d('0x46')];if(!_0x42d72e[_0xe37d('0x34')][_0xe37d('0x36')](_0xe37d('0x37'))){_0x6d7580[_0xe37d('0x1a')]=qs[_0xe37d('0x1a')](_0x42d72e[_0xe37d('0x34')][_0xe37d('0x1a')]);_0x6d7580['offset']=qs[_0xe37d('0x19')](_0x42d72e['query'][_0xe37d('0x19')]);}return _0x2d8e3c[_0xe37d('0x4c')](_0x6d7580);}})[_0xe37d('0x23')](function(_0x60a0d2){if(_0x60a0d2){return _0x60a0d2?{'count':_0x43833e,'rows':_0x60a0d2}:null;}})[_0xe37d('0x23')](respondWithResult(_0x19092a,null))[_0xe37d('0x43')](handleError(_0x19092a,null));};exports['getDescriptions']=function(_0x1ca192,_0x2c04ae,_0x60b67f){var _0x294b11={};var _0x17957e={};var _0x560855;var _0x5111df;return db['SalesforceConfiguration'][_0xe37d('0x4b')]({'where':{'id':_0x1ca192['params']['id']}})[_0xe37d('0x23')](handleEntityNotFound(_0x2c04ae,null))[_0xe37d('0x23')](function(_0xa301fb){if(_0xa301fb){_0x560855=_0xa301fb;_0x17957e['model']=_[_0xe37d('0x30')](db['SalesforceField']['rawAttributes']);_0x17957e[_0xe37d('0x34')]=_[_0xe37d('0x30')](_0x1ca192['query']);_0x17957e[_0xe37d('0x31')]=_[_0xe37d('0x32')](_0x17957e[_0xe37d('0x2f')],_0x17957e['query']);_0x294b11[_0xe37d('0x35')]=_['intersection'](_0x17957e[_0xe37d('0x2f')],qs[_0xe37d('0x33')](_0x1ca192[_0xe37d('0x34')]['fields']));_0x294b11[_0xe37d('0x35')]=_0x294b11['attributes']['length']?_0x294b11[_0xe37d('0x35')]:_0x17957e[_0xe37d('0x2f')];_0x294b11[_0xe37d('0x38')]=qs['sort'](_0x1ca192[_0xe37d('0x34')]['sort']);_0x294b11['where']=qs[_0xe37d('0x31')](_[_0xe37d('0x4e')](_0x1ca192[_0xe37d('0x34')],_0x17957e[_0xe37d('0x31')]));if(_0x1ca192['query']['filter']){_0x294b11[_0xe37d('0x3b')]=_[_0xe37d('0x3d')](_0x294b11['where'],{'$or':_['map'](_0x294b11[_0xe37d('0x35')],function(_0x2b58af){var _0x124663={};_0x124663[_0x2b58af]={'$like':'%'+_0x1ca192[_0xe37d('0x34')][_0xe37d('0x3a')]+'%'};return _0x124663;})});}_0x294b11=_[_0xe37d('0x3d')]({},_0x294b11,_0x1ca192['options']);return _0x560855[_0xe37d('0x4f')](_0x294b11);}})['then'](function(_0x1bbacf){if(_0x1bbacf){_0x5111df=_0x1bbacf[_0xe37d('0x46')];if(!_0x1ca192[_0xe37d('0x34')][_0xe37d('0x36')](_0xe37d('0x37'))){_0x294b11['limit']=qs[_0xe37d('0x1a')](_0x1ca192[_0xe37d('0x34')][_0xe37d('0x1a')]);_0x294b11[_0xe37d('0x19')]=qs['offset'](_0x1ca192[_0xe37d('0x34')][_0xe37d('0x19')]);}return _0x560855[_0xe37d('0x4f')](_0x294b11);}})[_0xe37d('0x23')](function(_0x30bc2e){if(_0x30bc2e){return _0x30bc2e?{'count':_0x5111df,'rows':_0x30bc2e}:null;}})[_0xe37d('0x23')](respondWithResult(_0x2c04ae,null))[_0xe37d('0x43')](handleError(_0x2c04ae,null));};
\ No newline at end of file