Built motion from commit (unavailable).|2.5.26
[motion2.git] / server / api / intSalesforceConfiguration / intSalesforceConfiguration.controller.js
index 889373a..eabfa9f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x31f0=['model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','find','create','body','update','getFields','order','getSubjects','findOne','SalesforceField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key'];(function(_0xe6894,_0x5a1755){var _0x4e2ea7=function(_0x535e0a){while(--_0x535e0a){_0xe6894['push'](_0xe6894['shift']());}};_0x4e2ea7(++_0x5a1755);}(_0x31f0,0x1f1));var _0x031f=function(_0x1f05a8,_0x195e47){_0x1f05a8=_0x1f05a8-0x0;var _0x51cb4e=_0x31f0[_0x1f05a8];return _0x51cb4e;};'use strict';var pdf=require(_0x031f('0x0'));var emlformat=require(_0x031f('0x1'));var rimraf=require(_0x031f('0x2'));var zipdir=require(_0x031f('0x3'));var jsonpatch=require(_0x031f('0x4'));var rp=require(_0x031f('0x5'));var moment=require(_0x031f('0x6'));var BPromise=require(_0x031f('0x7'));var Mustache=require(_0x031f('0x8'));var util=require('util');var path=require(_0x031f('0x9'));var sox=require('sox');var csv=require(_0x031f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x031f('0xb'));var crypto=require(_0x031f('0xc'));var jsforce=require(_0x031f('0xd'));var deskjs=require(_0x031f('0xe'));var toCsv=require(_0x031f('0xa'));var querystring=require(_0x031f('0xf'));var Papa=require(_0x031f('0x10'));var Redis=require(_0x031f('0x11'));var authService=require(_0x031f('0x12'));var qs=require(_0x031f('0x13'));var as=require(_0x031f('0x14'));var hardwareService=require(_0x031f('0x15'));var logger=require(_0x031f('0x16'))('api');var utils=require(_0x031f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x031f('0x18'))['db'];var jayson=require(_0x031f('0x19'));var client=jayson[_0x031f('0x1a')][_0x031f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x40e594,_0x512292,_0x51cf19,_0x1b8094){return new BPromise(function(_0x33581a,_0x56553f){var _0xd67d27=_0x1b8094||client;return _0xd67d27['request'](_0x40e594,_0x51cf19)[_0x031f('0x1c')](function(_0x1ea1a8){logger[_0x031f('0x1d')](_0x031f('0x1e'),_0x512292,'request\x20sent');logger[_0x031f('0x1f')](_0x031f('0x20'),_0x512292,_0x031f('0x21'),JSON[_0x031f('0x22')](_0x1ea1a8));if(_0x1ea1a8[_0x031f('0x23')]){if(_0x1ea1a8['error'][_0x031f('0x24')]===0x1f4){logger[_0x031f('0x23')](_0x031f('0x1e'),_0x512292,_0x1ea1a8[_0x031f('0x23')][_0x031f('0x25')]);return _0x56553f(_0x1ea1a8[_0x031f('0x23')]['message']);}logger[_0x031f('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x512292,_0x1ea1a8[_0x031f('0x23')][_0x031f('0x25')]);return _0x33581a(_0x1ea1a8['error'][_0x031f('0x25')]);}else{logger[_0x031f('0x1d')](_0x031f('0x1e'),_0x512292,_0x031f('0x21'));_0x33581a(_0x1ea1a8[_0x031f('0x26')][_0x031f('0x25')]);}})[_0x031f('0x27')](function(_0x6cda95){logger[_0x031f('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x512292,_0x6cda95);_0x56553f(_0x6cda95);});});}function respondWithStatusCode(_0x41ce3d,_0xfcd9c9){_0xfcd9c9=_0xfcd9c9||0xcc;return function(_0x62c1e){if(_0x62c1e){return _0x41ce3d[_0x031f('0x28')](_0xfcd9c9);}return _0x41ce3d[_0x031f('0x29')](_0xfcd9c9)[_0x031f('0x2a')]();};}function respondWithResult(_0x41e442,_0x27ac22){_0x27ac22=_0x27ac22||0xc8;return function(_0x196cd6){if(_0x196cd6){return _0x41e442[_0x031f('0x29')](_0x27ac22)[_0x031f('0x2b')](_0x196cd6);}};}function respondWithFilteredResult(_0x2d1fd9,_0x25fbfe){return function(_0xa10fa0){if(_0xa10fa0){var _0x3de130=_0xa10fa0[_0x031f('0x2c')],_0x4bd5cb=_0x25fbfe['offset'],_0x499d4f=_0x25fbfe[_0x031f('0x2d')]+_0x25fbfe[_0x031f('0x2e')],_0x268e57;if(_0x499d4f>=_0x3de130){_0x499d4f=_0x3de130;_0x268e57=0xc8;}else{_0x268e57=0xce;}_0x2d1fd9[_0x031f('0x29')](_0x268e57);return _0x2d1fd9[_0x031f('0x2f')](_0x031f('0x30'),_0x4bd5cb+'-'+_0x499d4f+'/'+_0x3de130)[_0x031f('0x2b')](_0xa10fa0);}return null;};}function patchUpdates(_0x3def20){return function(_0x35a663){try{jsonpatch[_0x031f('0x31')](_0x35a663,_0x3def20,!![]);}catch(_0x4b47e2){return BPromise['reject'](_0x4b47e2);}return _0x35a663[_0x031f('0x32')]();};}function saveUpdates(_0x7bd8e9,_0x8ff6f4){return function(_0x2efdf7){if(_0x2efdf7){return _0x2efdf7['update'](_0x7bd8e9)[_0x031f('0x1c')](function(_0x290bf7){return _0x290bf7;});}return null;};}function removeEntity(_0x153959,_0x1e0fc1){return function(_0x34c004){if(_0x34c004){return _0x34c004[_0x031f('0x33')]()['then'](function(){_0x153959[_0x031f('0x29')](0xcc)[_0x031f('0x2a')]();});}};}function handleEntityNotFound(_0x49e585,_0x16bfc9){return function(_0x18a663){if(!_0x18a663){_0x49e585[_0x031f('0x28')](0x194);}return _0x18a663;};}function handleError(_0x2cbf96,_0xbc36b2){_0xbc36b2=_0xbc36b2||0x1f4;return function(_0x473999){logger[_0x031f('0x23')](_0x473999[_0x031f('0x34')]);if(_0x473999['name']){delete _0x473999[_0x031f('0x35')];}_0x2cbf96[_0x031f('0x29')](_0xbc36b2)[_0x031f('0x36')](_0x473999);};}exports['index']=function(_0x5beab8,_0x258c88){var _0x47b9c2={},_0x2524f2={},_0x430ce0={'count':0x0,'rows':[]};var _0x4d190c=_[_0x031f('0x37')](db[_0x031f('0x38')][_0x031f('0x39')],function(_0x4b4b27){return{'name':_0x4b4b27[_0x031f('0x3a')],'type':_0x4b4b27[_0x031f('0x3b')][_0x031f('0x3c')]};});_0x2524f2[_0x031f('0x3d')]=_[_0x031f('0x37')](_0x4d190c,_0x031f('0x35'));_0x2524f2[_0x031f('0x3e')]=_['keys'](_0x5beab8['query']);_0x2524f2['filters']=_[_0x031f('0x3f')](_0x2524f2[_0x031f('0x3d')],_0x2524f2[_0x031f('0x3e')]);_0x47b9c2[_0x031f('0x40')]=_[_0x031f('0x3f')](_0x2524f2[_0x031f('0x3d')],qs[_0x031f('0x41')](_0x5beab8[_0x031f('0x3e')]['fields']));_0x47b9c2['attributes']=_0x47b9c2[_0x031f('0x40')][_0x031f('0x42')]?_0x47b9c2['attributes']:_0x2524f2['model'];if(!_0x5beab8[_0x031f('0x3e')][_0x031f('0x43')](_0x031f('0x44'))){_0x47b9c2[_0x031f('0x2e')]=qs[_0x031f('0x2e')](_0x5beab8[_0x031f('0x3e')][_0x031f('0x2e')]);_0x47b9c2[_0x031f('0x2d')]=qs['offset'](_0x5beab8[_0x031f('0x3e')]['offset']);}_0x47b9c2['order']=qs[_0x031f('0x45')](_0x5beab8[_0x031f('0x3e')][_0x031f('0x45')]);_0x47b9c2[_0x031f('0x46')]=qs[_0x031f('0x47')](_[_0x031f('0x48')](_0x5beab8[_0x031f('0x3e')],_0x2524f2[_0x031f('0x47')]),_0x4d190c);if(_0x5beab8[_0x031f('0x3e')][_0x031f('0x49')]){_0x47b9c2[_0x031f('0x46')]=_['merge'](_0x47b9c2['where'],{'$or':_[_0x031f('0x37')](_0x4d190c,function(_0x922449){if(_0x922449[_0x031f('0x3b')]!==_0x031f('0x4a')){var _0x53c661={};_0x53c661[_0x922449[_0x031f('0x35')]]={'$like':'%'+_0x5beab8[_0x031f('0x3e')][_0x031f('0x49')]+'%'};return _0x53c661;}})});}_0x47b9c2=_[_0x031f('0x4b')]({},_0x47b9c2,_0x5beab8[_0x031f('0x4c')]);var _0x287da0={'where':_0x47b9c2[_0x031f('0x46')]};return db[_0x031f('0x38')][_0x031f('0x2c')](_0x287da0)['then'](function(_0x3f4974){_0x430ce0[_0x031f('0x2c')]=_0x3f4974;if(_0x5beab8[_0x031f('0x3e')][_0x031f('0x4d')]){_0x47b9c2[_0x031f('0x4e')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x031f('0x4f')](_0x47b9c2);})[_0x031f('0x1c')](function(_0x4ee1e2){_0x430ce0['rows']=_0x4ee1e2;return _0x430ce0;})[_0x031f('0x1c')](respondWithFilteredResult(_0x258c88,_0x47b9c2))[_0x031f('0x27')](handleError(_0x258c88,null));};exports[_0x031f('0x50')]=function(_0x58e11d,_0xbd880d){var _0x386c2d={'raw':![],'where':{'id':_0x58e11d[_0x031f('0x51')]['id']}},_0x10c3a5={};_0x10c3a5[_0x031f('0x3d')]=_['keys'](db['SalesforceConfiguration']['rawAttributes']);_0x10c3a5[_0x031f('0x3e')]=_[_0x031f('0x52')](_0x58e11d['query']);_0x10c3a5['filters']=_[_0x031f('0x3f')](_0x10c3a5[_0x031f('0x3d')],_0x10c3a5['query']);_0x386c2d[_0x031f('0x40')]=_[_0x031f('0x3f')](_0x10c3a5['model'],qs[_0x031f('0x41')](_0x58e11d['query'][_0x031f('0x41')]));_0x386c2d[_0x031f('0x40')]=_0x386c2d[_0x031f('0x40')][_0x031f('0x42')]?_0x386c2d[_0x031f('0x40')]:_0x10c3a5[_0x031f('0x3d')];if(_0x58e11d[_0x031f('0x3e')][_0x031f('0x4d')]){_0x386c2d[_0x031f('0x4e')]=[{'all':!![]}];}_0x386c2d=_[_0x031f('0x4b')]({},_0x386c2d,_0x58e11d[_0x031f('0x4c')]);return db[_0x031f('0x38')][_0x031f('0x53')](_0x386c2d)[_0x031f('0x1c')](handleEntityNotFound(_0xbd880d,null))['then'](respondWithResult(_0xbd880d,null))[_0x031f('0x27')](handleError(_0xbd880d,null));};exports[_0x031f('0x54')]=function(_0x4cbb89,_0x11faaf){return db['SalesforceConfiguration'][_0x031f('0x54')](_0x4cbb89[_0x031f('0x55')],{})[_0x031f('0x1c')](respondWithResult(_0x11faaf,0xc9))[_0x031f('0x27')](handleError(_0x11faaf,null));};exports[_0x031f('0x56')]=function(_0x3aa7bb,_0x2c3982){if(_0x3aa7bb[_0x031f('0x55')]['id']){delete _0x3aa7bb[_0x031f('0x55')]['id'];}return db[_0x031f('0x38')]['find']({'where':{'id':_0x3aa7bb[_0x031f('0x51')]['id']}})['then'](handleEntityNotFound(_0x2c3982,null))[_0x031f('0x1c')](saveUpdates(_0x3aa7bb[_0x031f('0x55')],null))[_0x031f('0x1c')](respondWithResult(_0x2c3982,null))[_0x031f('0x27')](handleError(_0x2c3982,null));};exports[_0x031f('0x33')]=function(_0x100282,_0x40d801){return db[_0x031f('0x38')][_0x031f('0x53')]({'where':{'id':_0x100282[_0x031f('0x51')]['id']}})['then'](handleEntityNotFound(_0x40d801,null))['then'](removeEntity(_0x40d801,null))[_0x031f('0x27')](handleError(_0x40d801,null));};exports[_0x031f('0x57')]=function(_0xa26e25,_0x32e56d,_0x487471){var _0x3a0f7f={};var _0xd91846={};var _0x48bbd5;var _0x24266f;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0xa26e25[_0x031f('0x51')]['id']}})[_0x031f('0x1c')](handleEntityNotFound(_0x32e56d,null))[_0x031f('0x1c')](function(_0x267a88){if(_0x267a88){_0x48bbd5=_0x267a88;_0xd91846[_0x031f('0x3d')]=_[_0x031f('0x52')](db['SalesforceField'][_0x031f('0x39')]);_0xd91846[_0x031f('0x3e')]=_[_0x031f('0x52')](_0xa26e25['query']);_0xd91846[_0x031f('0x47')]=_[_0x031f('0x3f')](_0xd91846[_0x031f('0x3d')],_0xd91846[_0x031f('0x3e')]);_0x3a0f7f[_0x031f('0x40')]=_[_0x031f('0x3f')](_0xd91846[_0x031f('0x3d')],qs[_0x031f('0x41')](_0xa26e25[_0x031f('0x3e')]['fields']));_0x3a0f7f[_0x031f('0x40')]=_0x3a0f7f[_0x031f('0x40')][_0x031f('0x42')]?_0x3a0f7f[_0x031f('0x40')]:_0xd91846['model'];_0x3a0f7f[_0x031f('0x58')]=qs[_0x031f('0x45')](_0xa26e25[_0x031f('0x3e')][_0x031f('0x45')]);_0x3a0f7f[_0x031f('0x46')]=qs[_0x031f('0x47')](_['pick'](_0xa26e25[_0x031f('0x3e')],_0xd91846[_0x031f('0x47')]));if(_0xa26e25[_0x031f('0x3e')][_0x031f('0x49')]){_0x3a0f7f['where']=_[_0x031f('0x4b')](_0x3a0f7f[_0x031f('0x46')],{'$or':_[_0x031f('0x37')](_0x3a0f7f[_0x031f('0x40')],function(_0x5db144){var _0x382a64={};_0x382a64[_0x5db144]={'$like':'%'+_0xa26e25['query']['filter']+'%'};return _0x382a64;})});}_0x3a0f7f=_[_0x031f('0x4b')]({},_0x3a0f7f,_0xa26e25['options']);return _0x48bbd5['getFields'](_0x3a0f7f);}})[_0x031f('0x1c')](function(_0xb0cd9b){if(_0xb0cd9b){_0x24266f=_0xb0cd9b[_0x031f('0x42')];if(!_0xa26e25[_0x031f('0x3e')][_0x031f('0x43')](_0x031f('0x44'))){_0x3a0f7f[_0x031f('0x2e')]=qs[_0x031f('0x2e')](_0xa26e25[_0x031f('0x3e')]['limit']);_0x3a0f7f[_0x031f('0x2d')]=qs['offset'](_0xa26e25[_0x031f('0x3e')][_0x031f('0x2d')]);}return _0x48bbd5[_0x031f('0x57')](_0x3a0f7f);}})[_0x031f('0x1c')](function(_0x3217ad){if(_0x3217ad){return _0x3217ad?{'count':_0x24266f,'rows':_0x3217ad}:null;}})[_0x031f('0x1c')](respondWithResult(_0x32e56d,null))[_0x031f('0x27')](handleError(_0x32e56d,null));};exports[_0x031f('0x59')]=function(_0x46506b,_0x2c36ca,_0x5468e9){var _0x22acfb={};var _0x329d06={};var _0x56aa1f;var _0x3a1431;return db['SalesforceConfiguration'][_0x031f('0x5a')]({'where':{'id':_0x46506b['params']['id']}})[_0x031f('0x1c')](handleEntityNotFound(_0x2c36ca,null))['then'](function(_0x2cab85){if(_0x2cab85){_0x56aa1f=_0x2cab85;_0x329d06[_0x031f('0x3d')]=_[_0x031f('0x52')](db[_0x031f('0x5b')][_0x031f('0x39')]);_0x329d06[_0x031f('0x3e')]=_[_0x031f('0x52')](_0x46506b[_0x031f('0x3e')]);_0x329d06[_0x031f('0x47')]=_[_0x031f('0x3f')](_0x329d06[_0x031f('0x3d')],_0x329d06[_0x031f('0x3e')]);_0x22acfb[_0x031f('0x40')]=_['intersection'](_0x329d06['model'],qs['fields'](_0x46506b[_0x031f('0x3e')]['fields']));_0x22acfb['attributes']=_0x22acfb[_0x031f('0x40')][_0x031f('0x42')]?_0x22acfb[_0x031f('0x40')]:_0x329d06['model'];_0x22acfb[_0x031f('0x58')]=qs['sort'](_0x46506b[_0x031f('0x3e')][_0x031f('0x45')]);_0x22acfb[_0x031f('0x46')]=qs['filters'](_[_0x031f('0x48')](_0x46506b['query'],_0x329d06[_0x031f('0x47')]));if(_0x46506b[_0x031f('0x3e')][_0x031f('0x49')]){_0x22acfb[_0x031f('0x46')]=_[_0x031f('0x4b')](_0x22acfb[_0x031f('0x46')],{'$or':_[_0x031f('0x37')](_0x22acfb[_0x031f('0x40')],function(_0x3f8184){var _0x1bf8a1={};_0x1bf8a1[_0x3f8184]={'$like':'%'+_0x46506b[_0x031f('0x3e')][_0x031f('0x49')]+'%'};return _0x1bf8a1;})});}_0x22acfb=_[_0x031f('0x4b')]({},_0x22acfb,_0x46506b[_0x031f('0x4c')]);return _0x56aa1f['getSubjects'](_0x22acfb);}})[_0x031f('0x1c')](function(_0x249c42){if(_0x249c42){_0x3a1431=_0x249c42[_0x031f('0x42')];if(!_0x46506b[_0x031f('0x3e')][_0x031f('0x43')]('nolimit')){_0x22acfb['limit']=qs[_0x031f('0x2e')](_0x46506b[_0x031f('0x3e')]['limit']);_0x22acfb['offset']=qs[_0x031f('0x2d')](_0x46506b[_0x031f('0x3e')][_0x031f('0x2d')]);}return _0x56aa1f[_0x031f('0x59')](_0x22acfb);}})['then'](function(_0x4d9de7){if(_0x4d9de7){return _0x4d9de7?{'count':_0x3a1431,'rows':_0x4d9de7}:null;}})[_0x031f('0x1c')](respondWithResult(_0x2c36ca,null))['catch'](handleError(_0x2c36ca,null));};exports['getDescriptions']=function(_0x48fbb2,_0x223e42,_0x603bfd){var _0x2f5b41={};var _0x2a3564={};var _0x5e2a3f;var _0xae96fe;return db[_0x031f('0x38')]['findOne']({'where':{'id':_0x48fbb2[_0x031f('0x51')]['id']}})[_0x031f('0x1c')](handleEntityNotFound(_0x223e42,null))[_0x031f('0x1c')](function(_0x5b3df0){if(_0x5b3df0){_0x5e2a3f=_0x5b3df0;_0x2a3564[_0x031f('0x3d')]=_[_0x031f('0x52')](db['SalesforceField']['rawAttributes']);_0x2a3564[_0x031f('0x3e')]=_[_0x031f('0x52')](_0x48fbb2[_0x031f('0x3e')]);_0x2a3564[_0x031f('0x47')]=_[_0x031f('0x3f')](_0x2a3564[_0x031f('0x3d')],_0x2a3564[_0x031f('0x3e')]);_0x2f5b41[_0x031f('0x40')]=_[_0x031f('0x3f')](_0x2a3564[_0x031f('0x3d')],qs[_0x031f('0x41')](_0x48fbb2[_0x031f('0x3e')][_0x031f('0x41')]));_0x2f5b41[_0x031f('0x40')]=_0x2f5b41[_0x031f('0x40')][_0x031f('0x42')]?_0x2f5b41['attributes']:_0x2a3564[_0x031f('0x3d')];_0x2f5b41[_0x031f('0x58')]=qs['sort'](_0x48fbb2[_0x031f('0x3e')][_0x031f('0x45')]);_0x2f5b41[_0x031f('0x46')]=qs[_0x031f('0x47')](_[_0x031f('0x48')](_0x48fbb2[_0x031f('0x3e')],_0x2a3564[_0x031f('0x47')]));if(_0x48fbb2[_0x031f('0x3e')][_0x031f('0x49')]){_0x2f5b41['where']=_[_0x031f('0x4b')](_0x2f5b41[_0x031f('0x46')],{'$or':_[_0x031f('0x37')](_0x2f5b41[_0x031f('0x40')],function(_0x46a6a3){var _0xda84cf={};_0xda84cf[_0x46a6a3]={'$like':'%'+_0x48fbb2[_0x031f('0x3e')]['filter']+'%'};return _0xda84cf;})});}_0x2f5b41=_['merge']({},_0x2f5b41,_0x48fbb2[_0x031f('0x4c')]);return _0x5e2a3f[_0x031f('0x5c')](_0x2f5b41);}})[_0x031f('0x1c')](function(_0x369441){if(_0x369441){_0xae96fe=_0x369441[_0x031f('0x42')];if(!_0x48fbb2[_0x031f('0x3e')][_0x031f('0x43')](_0x031f('0x44'))){_0x2f5b41[_0x031f('0x2e')]=qs[_0x031f('0x2e')](_0x48fbb2['query'][_0x031f('0x2e')]);_0x2f5b41[_0x031f('0x2d')]=qs[_0x031f('0x2d')](_0x48fbb2[_0x031f('0x3e')][_0x031f('0x2d')]);}return _0x5e2a3f['getDescriptions'](_0x2f5b41);}})[_0x031f('0x1c')](function(_0x143ebb){if(_0x143ebb){return _0x143ebb?{'count':_0xae96fe,'rows':_0x143ebb}:null;}})[_0x031f('0x1c')](respondWithResult(_0x223e42,null))['catch'](handleError(_0x223e42,null));};
\ No newline at end of file
+var _0xac93=['end','sendStatus','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','count','findAll','rows','show','params','includeAll','find','create','body','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy'];(function(_0x30ea66,_0x3dec2b){var _0x5333d5=function(_0x41675d){while(--_0x41675d){_0x30ea66['push'](_0x30ea66['shift']());}};_0x5333d5(++_0x3dec2b);}(_0xac93,0x1dc));var _0x3ac9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xac93[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x3ac9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ac9('0x1'));var rp=require(_0x3ac9('0x2'));var moment=require(_0x3ac9('0x3'));var BPromise=require(_0x3ac9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3ac9('0x5'));var sox=require(_0x3ac9('0x6'));var csv=require(_0x3ac9('0x7'));var ejs=require(_0x3ac9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3ac9('0x9'));var crypto=require('crypto');var jsforce=require(_0x3ac9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3ac9('0x7'));var querystring=require('querystring');var Papa=require(_0x3ac9('0xb'));var Redis=require(_0x3ac9('0xc'));var authService=require(_0x3ac9('0xd'));var qs=require(_0x3ac9('0xe'));var as=require(_0x3ac9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ac9('0x10'))(_0x3ac9('0x11'));var utils=require(_0x3ac9('0x12'));var config=require(_0x3ac9('0x13'));var licenseUtil=require(_0x3ac9('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3ac9('0x15'));var client=jayson[_0x3ac9('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21745a,_0x11cf53,_0x25f7a7,_0x316726){return new BPromise(function(_0x4da078,_0x111fa8){var _0xd962a5=_0x316726||client;return _0xd962a5['request'](_0x21745a,_0x25f7a7)[_0x3ac9('0x17')](function(_0x3b34d2){logger[_0x3ac9('0x18')](_0x3ac9('0x19'),_0x11cf53,_0x3ac9('0x1a'));logger[_0x3ac9('0x1b')](_0x3ac9('0x1c'),_0x11cf53,_0x3ac9('0x1a'),JSON[_0x3ac9('0x1d')](_0x3b34d2));if(_0x3b34d2[_0x3ac9('0x1e')]){if(_0x3b34d2['error'][_0x3ac9('0x1f')]===0x1f4){logger[_0x3ac9('0x1e')](_0x3ac9('0x19'),_0x11cf53,_0x3b34d2['error'][_0x3ac9('0x20')]);return _0x111fa8(_0x3b34d2[_0x3ac9('0x1e')][_0x3ac9('0x20')]);}logger['error'](_0x3ac9('0x19'),_0x11cf53,_0x3b34d2[_0x3ac9('0x1e')][_0x3ac9('0x20')]);return _0x4da078(_0x3b34d2[_0x3ac9('0x1e')][_0x3ac9('0x20')]);}else{logger[_0x3ac9('0x18')](_0x3ac9('0x19'),_0x11cf53,_0x3ac9('0x1a'));_0x4da078(_0x3b34d2[_0x3ac9('0x21')]['message']);}})[_0x3ac9('0x22')](function(_0x33295e){logger[_0x3ac9('0x1e')](_0x3ac9('0x19'),_0x11cf53,_0x33295e);_0x111fa8(_0x33295e);});});}function respondWithStatusCode(_0x3d80cb,_0x5bdc39){_0x5bdc39=_0x5bdc39||0xcc;return function(_0x3f4bf3){if(_0x3f4bf3){return _0x3d80cb['sendStatus'](_0x5bdc39);}return _0x3d80cb['status'](_0x5bdc39)['end']();};}function respondWithResult(_0x2a802a,_0x45d213){_0x45d213=_0x45d213||0xc8;return function(_0x38b2de){if(_0x38b2de){return _0x2a802a[_0x3ac9('0x23')](_0x45d213)['json'](_0x38b2de);}};}function respondWithFilteredResult(_0x7f6839,_0x53f982){return function(_0x18b864){if(_0x18b864){var _0x534900=_0x18b864['count'],_0x39aea4=_0x53f982[_0x3ac9('0x24')],_0x40c7db=_0x53f982[_0x3ac9('0x24')]+_0x53f982[_0x3ac9('0x25')],_0x43dfab;if(_0x40c7db>=_0x534900){_0x40c7db=_0x534900;_0x43dfab=0xc8;}else{_0x43dfab=0xce;}_0x7f6839[_0x3ac9('0x23')](_0x43dfab);return _0x7f6839[_0x3ac9('0x26')](_0x3ac9('0x27'),_0x39aea4+'-'+_0x40c7db+'/'+_0x534900)[_0x3ac9('0x28')](_0x18b864);}return null;};}function patchUpdates(_0x125f78){return function(_0x1d134f){try{jsonpatch[_0x3ac9('0x29')](_0x1d134f,_0x125f78,!![]);}catch(_0x243b16){return BPromise[_0x3ac9('0x2a')](_0x243b16);}return _0x1d134f[_0x3ac9('0x2b')]();};}function saveUpdates(_0x486f17,_0x1c2929){return function(_0x4a7f13){if(_0x4a7f13){return _0x4a7f13[_0x3ac9('0x2c')](_0x486f17)[_0x3ac9('0x17')](function(_0x23001b){return _0x23001b;});}return null;};}function removeEntity(_0x5da002,_0x22f29b){return function(_0x475245){if(_0x475245){return _0x475245[_0x3ac9('0x2d')]()[_0x3ac9('0x17')](function(){_0x5da002[_0x3ac9('0x23')](0xcc)[_0x3ac9('0x2e')]();});}};}function handleEntityNotFound(_0x5a2000,_0x397314){return function(_0x2172c9){if(!_0x2172c9){_0x5a2000[_0x3ac9('0x2f')](0x194);}return _0x2172c9;};}function handleError(_0x5b2c11,_0x11a093){_0x11a093=_0x11a093||0x1f4;return function(_0x56e1a0){logger[_0x3ac9('0x1e')](_0x56e1a0[_0x3ac9('0x30')]);if(_0x56e1a0[_0x3ac9('0x31')]){delete _0x56e1a0[_0x3ac9('0x31')];}_0x5b2c11[_0x3ac9('0x23')](_0x11a093)['send'](_0x56e1a0);};}exports[_0x3ac9('0x32')]=function(_0x3e19ec,_0x1ea57f){var _0x27293f={},_0x1f24de={},_0x4d545d={'count':0x0,'rows':[]};var _0x166582=_[_0x3ac9('0x33')](db[_0x3ac9('0x34')][_0x3ac9('0x35')],function(_0x4a4bdb){return{'name':_0x4a4bdb[_0x3ac9('0x36')],'type':_0x4a4bdb[_0x3ac9('0x37')]['key']};});_0x1f24de['model']=_['map'](_0x166582,_0x3ac9('0x31'));_0x1f24de[_0x3ac9('0x38')]=_[_0x3ac9('0x39')](_0x3e19ec[_0x3ac9('0x38')]);_0x1f24de['filters']=_[_0x3ac9('0x3a')](_0x1f24de[_0x3ac9('0x3b')],_0x1f24de['query']);_0x27293f[_0x3ac9('0x3c')]=_[_0x3ac9('0x3a')](_0x1f24de[_0x3ac9('0x3b')],qs['fields'](_0x3e19ec['query'][_0x3ac9('0x3d')]));_0x27293f['attributes']=_0x27293f[_0x3ac9('0x3c')][_0x3ac9('0x3e')]?_0x27293f[_0x3ac9('0x3c')]:_0x1f24de[_0x3ac9('0x3b')];if(!_0x3e19ec[_0x3ac9('0x38')][_0x3ac9('0x3f')]('nolimit')){_0x27293f[_0x3ac9('0x25')]=qs['limit'](_0x3e19ec[_0x3ac9('0x38')][_0x3ac9('0x25')]);_0x27293f[_0x3ac9('0x24')]=qs[_0x3ac9('0x24')](_0x3e19ec[_0x3ac9('0x38')]['offset']);}_0x27293f[_0x3ac9('0x40')]=qs[_0x3ac9('0x41')](_0x3e19ec[_0x3ac9('0x38')]['sort']);_0x27293f['where']=qs[_0x3ac9('0x42')](_[_0x3ac9('0x43')](_0x3e19ec[_0x3ac9('0x38')],_0x1f24de['filters']),_0x166582);if(_0x3e19ec[_0x3ac9('0x38')][_0x3ac9('0x44')]){_0x27293f['where']=_['merge'](_0x27293f[_0x3ac9('0x45')],{'$or':_[_0x3ac9('0x33')](_0x166582,function(_0x4d13de){if(_0x4d13de[_0x3ac9('0x37')]!=='VIRTUAL'){var _0x49ef13={};_0x49ef13[_0x4d13de[_0x3ac9('0x31')]]={'$like':'%'+_0x3e19ec['query']['filter']+'%'};return _0x49ef13;}})});}_0x27293f=_[_0x3ac9('0x46')]({},_0x27293f,_0x3e19ec[_0x3ac9('0x47')]);var _0x3f7f03={'where':_0x27293f['where']};return db[_0x3ac9('0x34')]['count'](_0x3f7f03)[_0x3ac9('0x17')](function(_0x116b6b){_0x4d545d[_0x3ac9('0x48')]=_0x116b6b;if(_0x3e19ec[_0x3ac9('0x38')]['includeAll']){_0x27293f['include']=[{'all':!![]}];}return db[_0x3ac9('0x34')][_0x3ac9('0x49')](_0x27293f);})[_0x3ac9('0x17')](function(_0x114e6c){_0x4d545d[_0x3ac9('0x4a')]=_0x114e6c;return _0x4d545d;})['then'](respondWithFilteredResult(_0x1ea57f,_0x27293f))[_0x3ac9('0x22')](handleError(_0x1ea57f,null));};exports[_0x3ac9('0x4b')]=function(_0x1a870a,_0x47b204){var _0x3efa36={'raw':![],'where':{'id':_0x1a870a[_0x3ac9('0x4c')]['id']}},_0x589e4b={};_0x589e4b[_0x3ac9('0x3b')]=_['keys'](db[_0x3ac9('0x34')][_0x3ac9('0x35')]);_0x589e4b[_0x3ac9('0x38')]=_[_0x3ac9('0x39')](_0x1a870a['query']);_0x589e4b[_0x3ac9('0x42')]=_[_0x3ac9('0x3a')](_0x589e4b[_0x3ac9('0x3b')],_0x589e4b[_0x3ac9('0x38')]);_0x3efa36['attributes']=_[_0x3ac9('0x3a')](_0x589e4b[_0x3ac9('0x3b')],qs['fields'](_0x1a870a[_0x3ac9('0x38')][_0x3ac9('0x3d')]));_0x3efa36['attributes']=_0x3efa36[_0x3ac9('0x3c')][_0x3ac9('0x3e')]?_0x3efa36[_0x3ac9('0x3c')]:_0x589e4b['model'];if(_0x1a870a['query'][_0x3ac9('0x4d')]){_0x3efa36['include']=[{'all':!![]}];}_0x3efa36=_['merge']({},_0x3efa36,_0x1a870a[_0x3ac9('0x47')]);return db[_0x3ac9('0x34')][_0x3ac9('0x4e')](_0x3efa36)[_0x3ac9('0x17')](handleEntityNotFound(_0x47b204,null))[_0x3ac9('0x17')](respondWithResult(_0x47b204,null))['catch'](handleError(_0x47b204,null));};exports[_0x3ac9('0x4f')]=function(_0x3c4dbe,_0x328f78){return db['SalesforceConfiguration'][_0x3ac9('0x4f')](_0x3c4dbe[_0x3ac9('0x50')],{})[_0x3ac9('0x17')](respondWithResult(_0x328f78,0xc9))[_0x3ac9('0x22')](handleError(_0x328f78,null));};exports[_0x3ac9('0x2c')]=function(_0x5b284b,_0x1a889d){if(_0x5b284b['body']['id']){delete _0x5b284b[_0x3ac9('0x50')]['id'];}return db[_0x3ac9('0x34')][_0x3ac9('0x4e')]({'where':{'id':_0x5b284b[_0x3ac9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a889d,null))[_0x3ac9('0x17')](saveUpdates(_0x5b284b['body'],null))[_0x3ac9('0x17')](respondWithResult(_0x1a889d,null))[_0x3ac9('0x22')](handleError(_0x1a889d,null));};exports['destroy']=function(_0x4738bd,_0x190589){return db[_0x3ac9('0x34')][_0x3ac9('0x4e')]({'where':{'id':_0x4738bd[_0x3ac9('0x4c')]['id']}})[_0x3ac9('0x17')](handleEntityNotFound(_0x190589,null))[_0x3ac9('0x17')](removeEntity(_0x190589,null))[_0x3ac9('0x22')](handleError(_0x190589,null));};exports[_0x3ac9('0x51')]=function(_0x38ad99,_0x54344f,_0x55c6e1){var _0x6be3={};var _0x14977f={};var _0x2b956f;var _0x5eb832;return db[_0x3ac9('0x34')][_0x3ac9('0x52')]({'where':{'id':_0x38ad99[_0x3ac9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x54344f,null))[_0x3ac9('0x17')](function(_0x504ded){if(_0x504ded){_0x2b956f=_0x504ded;_0x14977f['model']=_[_0x3ac9('0x39')](db[_0x3ac9('0x53')][_0x3ac9('0x35')]);_0x14977f[_0x3ac9('0x38')]=_[_0x3ac9('0x39')](_0x38ad99['query']);_0x14977f[_0x3ac9('0x42')]=_[_0x3ac9('0x3a')](_0x14977f['model'],_0x14977f[_0x3ac9('0x38')]);_0x6be3[_0x3ac9('0x3c')]=_['intersection'](_0x14977f[_0x3ac9('0x3b')],qs['fields'](_0x38ad99[_0x3ac9('0x38')][_0x3ac9('0x3d')]));_0x6be3[_0x3ac9('0x3c')]=_0x6be3[_0x3ac9('0x3c')]['length']?_0x6be3[_0x3ac9('0x3c')]:_0x14977f[_0x3ac9('0x3b')];_0x6be3[_0x3ac9('0x40')]=qs[_0x3ac9('0x41')](_0x38ad99[_0x3ac9('0x38')][_0x3ac9('0x41')]);_0x6be3[_0x3ac9('0x45')]=qs['filters'](_['pick'](_0x38ad99[_0x3ac9('0x38')],_0x14977f['filters']));if(_0x38ad99[_0x3ac9('0x38')]['filter']){_0x6be3[_0x3ac9('0x45')]=_[_0x3ac9('0x46')](_0x6be3[_0x3ac9('0x45')],{'$or':_[_0x3ac9('0x33')](_0x6be3['attributes'],function(_0x2aac5c){var _0xe4c8be={};_0xe4c8be[_0x2aac5c]={'$like':'%'+_0x38ad99['query'][_0x3ac9('0x44')]+'%'};return _0xe4c8be;})});}_0x6be3=_[_0x3ac9('0x46')]({},_0x6be3,_0x38ad99[_0x3ac9('0x47')]);return _0x2b956f[_0x3ac9('0x51')](_0x6be3);}})['then'](function(_0x4004e3){if(_0x4004e3){_0x5eb832=_0x4004e3['length'];if(!_0x38ad99[_0x3ac9('0x38')][_0x3ac9('0x3f')](_0x3ac9('0x54'))){_0x6be3['limit']=qs[_0x3ac9('0x25')](_0x38ad99[_0x3ac9('0x38')][_0x3ac9('0x25')]);_0x6be3[_0x3ac9('0x24')]=qs['offset'](_0x38ad99[_0x3ac9('0x38')][_0x3ac9('0x24')]);}return _0x2b956f[_0x3ac9('0x51')](_0x6be3);}})[_0x3ac9('0x17')](function(_0x49b4da){if(_0x49b4da){return _0x49b4da?{'count':_0x5eb832,'rows':_0x49b4da}:null;}})[_0x3ac9('0x17')](respondWithResult(_0x54344f,null))[_0x3ac9('0x22')](handleError(_0x54344f,null));};exports[_0x3ac9('0x55')]=function(_0x13bec9,_0x10eabc,_0x104cc1){var _0x568890={};var _0x446ef5={};var _0x480c85;var _0xe74e17;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x13bec9['params']['id']}})[_0x3ac9('0x17')](handleEntityNotFound(_0x10eabc,null))[_0x3ac9('0x17')](function(_0x20b0ee){if(_0x20b0ee){_0x480c85=_0x20b0ee;_0x446ef5[_0x3ac9('0x3b')]=_[_0x3ac9('0x39')](db[_0x3ac9('0x53')][_0x3ac9('0x35')]);_0x446ef5[_0x3ac9('0x38')]=_['keys'](_0x13bec9['query']);_0x446ef5[_0x3ac9('0x42')]=_['intersection'](_0x446ef5[_0x3ac9('0x3b')],_0x446ef5['query']);_0x568890[_0x3ac9('0x3c')]=_[_0x3ac9('0x3a')](_0x446ef5['model'],qs[_0x3ac9('0x3d')](_0x13bec9[_0x3ac9('0x38')][_0x3ac9('0x3d')]));_0x568890['attributes']=_0x568890[_0x3ac9('0x3c')][_0x3ac9('0x3e')]?_0x568890[_0x3ac9('0x3c')]:_0x446ef5[_0x3ac9('0x3b')];_0x568890['order']=qs[_0x3ac9('0x41')](_0x13bec9['query'][_0x3ac9('0x41')]);_0x568890['where']=qs['filters'](_['pick'](_0x13bec9[_0x3ac9('0x38')],_0x446ef5[_0x3ac9('0x42')]));if(_0x13bec9[_0x3ac9('0x38')][_0x3ac9('0x44')]){_0x568890['where']=_[_0x3ac9('0x46')](_0x568890[_0x3ac9('0x45')],{'$or':_[_0x3ac9('0x33')](_0x568890[_0x3ac9('0x3c')],function(_0x37f8fd){var _0x3de2f7={};_0x3de2f7[_0x37f8fd]={'$like':'%'+_0x13bec9[_0x3ac9('0x38')][_0x3ac9('0x44')]+'%'};return _0x3de2f7;})});}_0x568890=_[_0x3ac9('0x46')]({},_0x568890,_0x13bec9[_0x3ac9('0x47')]);return _0x480c85[_0x3ac9('0x55')](_0x568890);}})[_0x3ac9('0x17')](function(_0x25548f){if(_0x25548f){_0xe74e17=_0x25548f[_0x3ac9('0x3e')];if(!_0x13bec9['query'][_0x3ac9('0x3f')](_0x3ac9('0x54'))){_0x568890['limit']=qs['limit'](_0x13bec9[_0x3ac9('0x38')][_0x3ac9('0x25')]);_0x568890[_0x3ac9('0x24')]=qs[_0x3ac9('0x24')](_0x13bec9[_0x3ac9('0x38')][_0x3ac9('0x24')]);}return _0x480c85[_0x3ac9('0x55')](_0x568890);}})[_0x3ac9('0x17')](function(_0x19edd8){if(_0x19edd8){return _0x19edd8?{'count':_0xe74e17,'rows':_0x19edd8}:null;}})['then'](respondWithResult(_0x10eabc,null))[_0x3ac9('0x22')](handleError(_0x10eabc,null));};exports['getDescriptions']=function(_0x86ac81,_0x2311f9,_0x11cb18){var _0x1903fd={};var _0x3adcbd={};var _0x4f6dbc;var _0x1edd09;return db[_0x3ac9('0x34')][_0x3ac9('0x52')]({'where':{'id':_0x86ac81['params']['id']}})[_0x3ac9('0x17')](handleEntityNotFound(_0x2311f9,null))[_0x3ac9('0x17')](function(_0x2a927d){if(_0x2a927d){_0x4f6dbc=_0x2a927d;_0x3adcbd[_0x3ac9('0x3b')]=_['keys'](db[_0x3ac9('0x53')][_0x3ac9('0x35')]);_0x3adcbd[_0x3ac9('0x38')]=_['keys'](_0x86ac81[_0x3ac9('0x38')]);_0x3adcbd[_0x3ac9('0x42')]=_[_0x3ac9('0x3a')](_0x3adcbd[_0x3ac9('0x3b')],_0x3adcbd[_0x3ac9('0x38')]);_0x1903fd[_0x3ac9('0x3c')]=_['intersection'](_0x3adcbd['model'],qs[_0x3ac9('0x3d')](_0x86ac81[_0x3ac9('0x38')]['fields']));_0x1903fd[_0x3ac9('0x3c')]=_0x1903fd['attributes'][_0x3ac9('0x3e')]?_0x1903fd[_0x3ac9('0x3c')]:_0x3adcbd[_0x3ac9('0x3b')];_0x1903fd[_0x3ac9('0x40')]=qs['sort'](_0x86ac81[_0x3ac9('0x38')][_0x3ac9('0x41')]);_0x1903fd['where']=qs['filters'](_[_0x3ac9('0x43')](_0x86ac81[_0x3ac9('0x38')],_0x3adcbd[_0x3ac9('0x42')]));if(_0x86ac81[_0x3ac9('0x38')][_0x3ac9('0x44')]){_0x1903fd[_0x3ac9('0x45')]=_[_0x3ac9('0x46')](_0x1903fd['where'],{'$or':_['map'](_0x1903fd[_0x3ac9('0x3c')],function(_0xad08b4){var _0x29c037={};_0x29c037[_0xad08b4]={'$like':'%'+_0x86ac81[_0x3ac9('0x38')]['filter']+'%'};return _0x29c037;})});}_0x1903fd=_[_0x3ac9('0x46')]({},_0x1903fd,_0x86ac81['options']);return _0x4f6dbc[_0x3ac9('0x56')](_0x1903fd);}})['then'](function(_0x1ba5db){if(_0x1ba5db){_0x1edd09=_0x1ba5db[_0x3ac9('0x3e')];if(!_0x86ac81[_0x3ac9('0x38')]['hasOwnProperty'](_0x3ac9('0x54'))){_0x1903fd[_0x3ac9('0x25')]=qs['limit'](_0x86ac81[_0x3ac9('0x38')][_0x3ac9('0x25')]);_0x1903fd[_0x3ac9('0x24')]=qs['offset'](_0x86ac81['query'][_0x3ac9('0x24')]);}return _0x4f6dbc['getDescriptions'](_0x1903fd);}})[_0x3ac9('0x17')](function(_0x4d21af){if(_0x4d21af){return _0x4d21af?{'count':_0x1edd09,'rows':_0x4d21af}:null;}})[_0x3ac9('0x17')](respondWithResult(_0x2311f9,null))[_0x3ac9('0x22')](handleError(_0x2311f9,null));};
\ No newline at end of file