Built motion from commit 953226e6.|2.6.32
[motion2.git] / server / api / intSalesforceAccount / intSalesforceAccount.controller.js
index 0ea432c..b9ba841 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x21f2=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','stack','name','send','SalesforceAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','rawAttributes','find','catch','create','body','params','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','channel','SalesforceField','Descriptions','Task','remoteUri','clientId','clientSecret','username','password','substring','lastIndexOf','Connection','login','concat','securityToken','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','textarea','phone','includes','label','custom','picklistValues','value','true','False','false','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','jsforce'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x21f2,0x6a));var _0x221f=function(_0x204e4c,_0x2d36a5){_0x204e4c=_0x204e4c-0x0;var _0x3684a7=_0x21f2[_0x204e4c];return _0x3684a7;};'use strict';var emlformat=require(_0x221f('0x0'));var rimraf=require(_0x221f('0x1'));var zipdir=require(_0x221f('0x2'));var jsonpatch=require(_0x221f('0x3'));var rp=require(_0x221f('0x4'));var moment=require('moment');var BPromise=require(_0x221f('0x5'));var Mustache=require(_0x221f('0x6'));var util=require(_0x221f('0x7'));var path=require('path');var sox=require(_0x221f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x221f('0x9'));var _=require(_0x221f('0xa'));var squel=require(_0x221f('0xb'));var crypto=require('crypto');var jsforce=require(_0x221f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x221f('0xd'));var Papa=require(_0x221f('0xe'));var Redis=require(_0x221f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x221f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x221f('0x11'));var logger=require(_0x221f('0x12'))('api');var utils=require(_0x221f('0x13'));var config=require(_0x221f('0x14'));var licenseUtil=require(_0x221f('0x15'));var db=require(_0x221f('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x254a21,_0x254c8f){_0x254c8f=_0x254c8f||0xcc;return function(_0x4d550c){if(_0x4d550c){return _0x254a21['sendStatus'](_0x254c8f);}return _0x254a21[_0x221f('0x17')](_0x254c8f)['end']();};}function respondWithResult(_0x16ed3f,_0x4d435f){_0x4d435f=_0x4d435f||0xc8;return function(_0x5d309a){if(_0x5d309a){return _0x16ed3f['status'](_0x4d435f)[_0x221f('0x18')](_0x5d309a);}};}function respondWithFilteredResult(_0x2c2a97,_0x38b37c){return function(_0x155848){if(_0x155848){var _0x4864b4=typeof _0x38b37c[_0x221f('0x19')]===_0x221f('0x1a')&&typeof _0x38b37c[_0x221f('0x1b')]===_0x221f('0x1a');var _0x580c29=_0x155848[_0x221f('0x1c')];var _0x1f9c70=_0x4864b4?0x0:_0x38b37c[_0x221f('0x19')];var _0x349855=_0x4864b4?_0x155848['count']:_0x38b37c[_0x221f('0x19')]+_0x38b37c[_0x221f('0x1b')];var _0x24d2be;if(_0x349855>=_0x580c29){_0x349855=_0x580c29;_0x24d2be=0xc8;}else{_0x24d2be=0xce;}_0x2c2a97['status'](_0x24d2be);return _0x2c2a97[_0x221f('0x1d')](_0x221f('0x1e'),_0x1f9c70+'-'+_0x349855+'/'+_0x580c29)['json'](_0x155848);}return null;};}function patchUpdates(_0x4aa913){return function(_0x1465ac){try{jsonpatch[_0x221f('0x1f')](_0x1465ac,_0x4aa913,!![]);}catch(_0x1936e0){return BPromise[_0x221f('0x20')](_0x1936e0);}return _0x1465ac['save']();};}function saveUpdates(_0x53584f,_0x32d89f){return function(_0x2fee88){if(_0x2fee88){return _0x2fee88[_0x221f('0x21')](_0x53584f)['then'](function(_0x5ab49f){return _0x5ab49f;});}return null;};}function removeEntity(_0x57fec4,_0x1ad962){return function(_0x3be249){if(_0x3be249){return _0x3be249[_0x221f('0x22')]()[_0x221f('0x23')](function(){_0x57fec4['status'](0xcc)[_0x221f('0x24')]();});}};}function handleEntityNotFound(_0x288ac5,_0xb23e5c){return function(_0x5af112){if(!_0x5af112){_0x288ac5[_0x221f('0x25')](0x194);}return _0x5af112;};}function handleError(_0x6e5c55,_0x10d09d){_0x10d09d=_0x10d09d||0x1f4;return function(_0x2887e7){logger['error'](_0x2887e7[_0x221f('0x26')]);if(_0x2887e7[_0x221f('0x27')]){delete _0x2887e7[_0x221f('0x27')];}_0x6e5c55[_0x221f('0x17')](_0x10d09d)[_0x221f('0x28')](_0x2887e7);};}exports['index']=function(_0xbd6496,_0x560bbc){var _0x589f65={},_0x13b239={},_0xb53624={'count':0x0,'rows':[]};var _0x20f2b3=_['map'](db[_0x221f('0x29')]['rawAttributes'],function(_0x437c74){return{'name':_0x437c74[_0x221f('0x2a')],'type':_0x437c74['type'][_0x221f('0x2b')]};});_0x13b239[_0x221f('0x2c')]=_['map'](_0x20f2b3,_0x221f('0x27'));_0x13b239[_0x221f('0x2d')]=_[_0x221f('0x2e')](_0xbd6496[_0x221f('0x2d')]);_0x13b239[_0x221f('0x2f')]=_[_0x221f('0x30')](_0x13b239[_0x221f('0x2c')],_0x13b239[_0x221f('0x2d')]);_0x589f65[_0x221f('0x31')]=_[_0x221f('0x30')](_0x13b239[_0x221f('0x2c')],qs[_0x221f('0x32')](_0xbd6496[_0x221f('0x2d')][_0x221f('0x32')]));_0x589f65[_0x221f('0x31')]=_0x589f65[_0x221f('0x31')][_0x221f('0x33')]?_0x589f65[_0x221f('0x31')]:_0x13b239['model'];if(!_0xbd6496['query'][_0x221f('0x34')]('nolimit')){_0x589f65['limit']=qs[_0x221f('0x1b')](_0xbd6496[_0x221f('0x2d')]['limit']);_0x589f65[_0x221f('0x19')]=qs[_0x221f('0x19')](_0xbd6496[_0x221f('0x2d')][_0x221f('0x19')]);}_0x589f65[_0x221f('0x35')]=qs['sort'](_0xbd6496['query'][_0x221f('0x36')]);_0x589f65['where']=qs['filters'](_[_0x221f('0x37')](_0xbd6496['query'],_0x13b239[_0x221f('0x2f')]),_0x20f2b3);if(_0xbd6496[_0x221f('0x2d')][_0x221f('0x38')]){_0x589f65[_0x221f('0x39')]=_[_0x221f('0x3a')](_0x589f65[_0x221f('0x39')],{'$or':_[_0x221f('0x3b')](_0x20f2b3,function(_0x55dee4){if(_0x55dee4[_0x221f('0x3c')]!==_0x221f('0x3d')){var _0x34e7af={};_0x34e7af[_0x55dee4['name']]={'$like':'%'+_0xbd6496['query']['filter']+'%'};return _0x34e7af;}})});}_0x589f65=_['merge']({},_0x589f65,_0xbd6496[_0x221f('0x3e')]);var _0x4037a1={'where':_0x589f65[_0x221f('0x39')]};return db[_0x221f('0x29')][_0x221f('0x1c')](_0x4037a1)['then'](function(_0x4216c8){_0xb53624[_0x221f('0x1c')]=_0x4216c8;if(_0xbd6496[_0x221f('0x2d')][_0x221f('0x3f')]){_0x589f65['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x221f('0x40')](_0x589f65);})[_0x221f('0x23')](function(_0x5370b8){_0xb53624[_0x221f('0x41')]=_0x5370b8;return _0xb53624;})['then'](respondWithFilteredResult(_0x560bbc,_0x589f65))['catch'](handleError(_0x560bbc,null));};exports['show']=function(_0x11da66,_0x1ecc5a){var _0xad48fc={'raw':![],'where':{'id':_0x11da66['params']['id']}},_0x408e11={};_0x408e11[_0x221f('0x2c')]=_[_0x221f('0x2e')](db[_0x221f('0x29')][_0x221f('0x42')]);_0x408e11[_0x221f('0x2d')]=_[_0x221f('0x2e')](_0x11da66[_0x221f('0x2d')]);_0x408e11[_0x221f('0x2f')]=_[_0x221f('0x30')](_0x408e11[_0x221f('0x2c')],_0x408e11[_0x221f('0x2d')]);_0xad48fc[_0x221f('0x31')]=_['intersection'](_0x408e11[_0x221f('0x2c')],qs[_0x221f('0x32')](_0x11da66[_0x221f('0x2d')][_0x221f('0x32')]));_0xad48fc[_0x221f('0x31')]=_0xad48fc['attributes']['length']?_0xad48fc[_0x221f('0x31')]:_0x408e11[_0x221f('0x2c')];if(_0x11da66[_0x221f('0x2d')]['includeAll']){_0xad48fc['include']=[{'all':!![]}];}_0xad48fc=_[_0x221f('0x3a')]({},_0xad48fc,_0x11da66['options']);return db[_0x221f('0x29')][_0x221f('0x43')](_0xad48fc)[_0x221f('0x23')](handleEntityNotFound(_0x1ecc5a,null))[_0x221f('0x23')](respondWithResult(_0x1ecc5a,null))[_0x221f('0x44')](handleError(_0x1ecc5a,null));};exports[_0x221f('0x45')]=function(_0x26d465,_0x126706){return db[_0x221f('0x29')]['create'](_0x26d465[_0x221f('0x46')],{})[_0x221f('0x23')](respondWithResult(_0x126706,0xc9))[_0x221f('0x44')](handleError(_0x126706,null));};exports['update']=function(_0x34465c,_0x2b3621){if(_0x34465c[_0x221f('0x46')]['id']){delete _0x34465c[_0x221f('0x46')]['id'];}return db[_0x221f('0x29')][_0x221f('0x43')]({'where':{'id':_0x34465c['params']['id']}})[_0x221f('0x23')](handleEntityNotFound(_0x2b3621,null))['then'](saveUpdates(_0x34465c[_0x221f('0x46')],null))[_0x221f('0x23')](respondWithResult(_0x2b3621,null))[_0x221f('0x44')](handleError(_0x2b3621,null));};exports[_0x221f('0x22')]=function(_0x4bdff9,_0xb40c65){return db[_0x221f('0x29')][_0x221f('0x43')]({'where':{'id':_0x4bdff9[_0x221f('0x47')]['id']}})[_0x221f('0x23')](handleEntityNotFound(_0xb40c65,null))[_0x221f('0x23')](removeEntity(_0xb40c65,null))['catch'](handleError(_0xb40c65,null));};exports[_0x221f('0x48')]=function(_0x3d6017,_0x1537fe,_0x51c825){var _0x29b8b8={};var _0x50a5e9={};var _0x15cdf8;var _0x49e546;return db[_0x221f('0x29')][_0x221f('0x49')]({'where':{'id':_0x3d6017[_0x221f('0x47')]['id']}})[_0x221f('0x23')](handleEntityNotFound(_0x1537fe,null))[_0x221f('0x23')](function(_0xb981f1){if(_0xb981f1){_0x15cdf8=_0xb981f1;_0x50a5e9['model']=_[_0x221f('0x2e')](db[_0x221f('0x4a')]['rawAttributes']);_0x50a5e9[_0x221f('0x2d')]=_[_0x221f('0x2e')](_0x3d6017['query']);_0x50a5e9['filters']=_[_0x221f('0x30')](_0x50a5e9['model'],_0x50a5e9[_0x221f('0x2d')]);_0x29b8b8['attributes']=_[_0x221f('0x30')](_0x50a5e9[_0x221f('0x2c')],qs['fields'](_0x3d6017[_0x221f('0x2d')][_0x221f('0x32')]));_0x29b8b8[_0x221f('0x31')]=_0x29b8b8[_0x221f('0x31')][_0x221f('0x33')]?_0x29b8b8['attributes']:_0x50a5e9[_0x221f('0x2c')];_0x29b8b8[_0x221f('0x35')]=qs[_0x221f('0x36')](_0x3d6017[_0x221f('0x2d')][_0x221f('0x36')]);_0x29b8b8[_0x221f('0x39')]=qs[_0x221f('0x2f')](_[_0x221f('0x37')](_0x3d6017['query'],_0x50a5e9[_0x221f('0x2f')]));if(_0x3d6017[_0x221f('0x2d')][_0x221f('0x38')]){_0x29b8b8[_0x221f('0x39')]=_[_0x221f('0x3a')](_0x29b8b8[_0x221f('0x39')],{'$or':_[_0x221f('0x3b')](_0x29b8b8[_0x221f('0x31')],function(_0x397416){var _0x4e5d64={};_0x4e5d64[_0x397416]={'$like':'%'+_0x3d6017[_0x221f('0x2d')][_0x221f('0x38')]+'%'};return _0x4e5d64;})});}_0x29b8b8=_[_0x221f('0x3a')]({},_0x29b8b8,_0x3d6017[_0x221f('0x3e')]);return _0x15cdf8['getConfigurations'](_0x29b8b8);}})[_0x221f('0x23')](function(_0x592442){if(_0x592442){_0x49e546=_0x592442[_0x221f('0x33')];if(!_0x3d6017[_0x221f('0x2d')][_0x221f('0x34')](_0x221f('0x4b'))){_0x29b8b8[_0x221f('0x1b')]=qs[_0x221f('0x1b')](_0x3d6017['query']['limit']);_0x29b8b8['offset']=qs['offset'](_0x3d6017[_0x221f('0x2d')][_0x221f('0x19')]);}return _0x15cdf8['getConfigurations'](_0x29b8b8);}})['then'](function(_0x24bdaa){if(_0x24bdaa){return _0x24bdaa?{'count':_0x49e546,'rows':_0x24bdaa}:null;}})[_0x221f('0x23')](respondWithResult(_0x1537fe,null))[_0x221f('0x44')](handleError(_0x1537fe,null));};exports[_0x221f('0x4c')]=function(_0x33bd12,_0x38985d,_0x1704f3){if(_0x33bd12[_0x221f('0x46')]['id']){delete _0x33bd12[_0x221f('0x46')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x33bd12[_0x221f('0x47')]['id']}})[_0x221f('0x23')](handleEntityNotFound(_0x38985d,null))[_0x221f('0x23')](function(_0x589f15){if(_0x589f15){_0x33bd12[_0x221f('0x46')][_0x221f('0x4d')]=_0x589f15['id'];_0x33bd12[_0x221f('0x46')][_0x221f('0x4e')]=integrations['getSubjects'](_0x33bd12[_0x221f('0x46')][_0x221f('0x4f')],_0x33bd12['body'][_0x221f('0x3c')]);_0x33bd12[_0x221f('0x46')]['Descriptions']=integrations['getDescriptions'](_0x33bd12[_0x221f('0x46')][_0x221f('0x4f')],_0x33bd12['body'][_0x221f('0x3c')]);return db['SalesforceConfiguration'][_0x221f('0x45')](_0x33bd12[_0x221f('0x46')],{'include':[{'model':db[_0x221f('0x50')],'as':_0x221f('0x4e')},{'model':db[_0x221f('0x50')],'as':_0x221f('0x51')}]});}return null;})[_0x221f('0x23')](respondWithResult(_0x38985d,null))[_0x221f('0x44')](handleError(_0x38985d,null));};exports['getFields']=function(_0x1050e,_0x310454,_0x220b53){var _0x2a17ce;var _0x35d3b8='';var _0x363cde=_0x221f('0x52');return db['SalesforceAccount'][_0x221f('0x49')]({'where':{'id':_0x1050e[_0x221f('0x47')]['id']},'attributes':['id',_0x221f('0x53'),_0x221f('0x54'),_0x221f('0x55'),_0x221f('0x56'),_0x221f('0x57'),'securityToken']})[_0x221f('0x23')](handleEntityNotFound(_0x310454,null))['then'](function(_0x2483d6){if(_0x2483d6){_0x35d3b8=_0x2483d6['remoteUri'];var _0x425b1e=_0x35d3b8['slice'](-0x1);if(_0x425b1e==='/'){_0x35d3b8=_0x35d3b8[_0x221f('0x58')](0x0,_0x35d3b8[_0x221f('0x59')](_0x425b1e));}_0x2a17ce=new jsforce[(_0x221f('0x5a'))]({'oauth2':{'loginUrl':_0x35d3b8,'clientId':_0x2483d6[_0x221f('0x54')],'clientSecret':_0x2483d6[_0x221f('0x55')]}});return _0x2a17ce[_0x221f('0x5b')](_0x2483d6[_0x221f('0x56')],_0x2483d6[_0x221f('0x57')][_0x221f('0x5c')](_0x2483d6[_0x221f('0x5d')]));}})['then'](function(_0x44ae0){if(_0x44ae0){if(!_['isNil'](_0x1050e['query'][_0x221f('0x5e')])){_0x363cde=_0x1050e[_0x221f('0x2d')][_0x221f('0x5e')];}return _0x2a17ce['sobject'](_0x363cde)[_0x221f('0x5f')]();}})[_0x221f('0x23')](function(_0x280176){var _0x68d877=[_0x221f('0x60'),'ActivityDate',_0x221f('0x61'),_0x221f('0x62'),_0x221f('0x63'),_0x221f('0x64')];var _0x369d9b=[_0x221f('0x65'),'int',_0x221f('0x66'),_0x221f('0x67'),'email',_0x221f('0x68'),_0x221f('0x69')];if(_0x280176){_['remove'](_0x280176[_0x221f('0x32')],function(_0x566232){return _0x68d877[_0x221f('0x6a')](_0x566232[_0x221f('0x27')])||!_0x369d9b[_0x221f('0x6a')](_0x566232[_0x221f('0x3c')]);});return{'count':_0x280176[_0x221f('0x32')][_0x221f('0x33')],'rows':_[_0x221f('0x3b')](_0x280176[_0x221f('0x32')],function(_0x2cd955){return{'id':_0x2cd955[_0x221f('0x27')],'name':_0x2cd955[_0x221f('0x6b')],'custom':_0x2cd955[_0x221f('0x6c')],'options':_0x2cd955[_0x221f('0x6d')][_0x221f('0x33')]>0x0?_[_0x221f('0x3b')](_0x2cd955[_0x221f('0x6d')],function(_0x21b87e){return{'name':_0x21b87e[_0x221f('0x6b')],'value':_0x21b87e[_0x221f('0x6e')]};}):_0x2cd955[_0x221f('0x3c')]=='boolean'?[{'name':'True','value':_0x221f('0x6f')},{'name':_0x221f('0x70'),'value':_0x221f('0x71')}]:[]};})};}})[_0x221f('0x23')](respondWithResult(_0x310454,null))[_0x221f('0x44')](function(_0x4d346d){var _0x3ff350=_0x1050e[_0x221f('0x2d')][_0x221f('0x72')]?0x1f4:_0x4d346d[_0x221f('0x73')]||0x1f4;logger[_0x221f('0x74')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3ff350,JSON[_0x221f('0x75')](_0x4d346d));delete _0x4d346d[_0x221f('0x27')];if(_0x3ff350===0x191){_0x3ff350=0x190;}_0x310454[_0x221f('0x17')](_0x3ff350)[_0x221f('0x28')](_0x1050e[_0x221f('0x2d')][_0x221f('0x72')]?{'message':_0x221f('0x76'),'statusCode':_0x4d346d[_0x221f('0x73')]}:_0x4d346d);});};
\ No newline at end of file
+var _0x439f=['undefined','limit','count','json','apply','save','update','then','end','sendStatus','error','send','index','map','SalesforceAccount','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','rows','show','params','keys','includeAll','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','remoteUri','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','email','phone','remove','includes','label','custom','picklistValues','boolean','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset'];(function(_0x5f037a,_0x174055){var _0x68027b=function(_0x3d5edd){while(--_0x3d5edd){_0x5f037a['push'](_0x5f037a['shift']());}};_0x68027b(++_0x174055);}(_0x439f,0x1de));var _0xf439=function(_0x17371c,_0x1a1e9c){_0x17371c=_0x17371c-0x0;var _0x422265=_0x439f[_0x17371c];return _0x422265;};'use strict';var emlformat=require(_0xf439('0x0'));var rimraf=require(_0xf439('0x1'));var zipdir=require(_0xf439('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf439('0x3'));var moment=require(_0xf439('0x4'));var BPromise=require(_0xf439('0x5'));var Mustache=require(_0xf439('0x6'));var util=require('util');var path=require(_0xf439('0x7'));var sox=require(_0xf439('0x8'));var csv=require(_0xf439('0x9'));var ejs=require(_0xf439('0xa'));var fs=require('fs');var fs_extra=require(_0xf439('0xb'));var _=require(_0xf439('0xc'));var squel=require(_0xf439('0xd'));var crypto=require(_0xf439('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf439('0xf'));var toCsv=require(_0xf439('0x9'));var querystring=require(_0xf439('0x10'));var Papa=require('papaparse');var Redis=require(_0xf439('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf439('0x12'));var as=require(_0xf439('0x13'));var hardwareService=require(_0xf439('0x14'));var logger=require(_0xf439('0x15'))(_0xf439('0x16'));var utils=require(_0xf439('0x17'));var config=require(_0xf439('0x18'));var licenseUtil=require(_0xf439('0x19'));var db=require(_0xf439('0x1a'))['db'];var integrations=require(_0xf439('0x1b'));function respondWithStatusCode(_0x16c954,_0x3288a2){_0x3288a2=_0x3288a2||0xcc;return function(_0x3197da){if(_0x3197da){return _0x16c954['sendStatus'](_0x3288a2);}return _0x16c954[_0xf439('0x1c')](_0x3288a2)['end']();};}function respondWithResult(_0x4f3054,_0x1f5c8d){_0x1f5c8d=_0x1f5c8d||0xc8;return function(_0x310dcc){if(_0x310dcc){return _0x4f3054[_0xf439('0x1c')](_0x1f5c8d)['json'](_0x310dcc);}};}function respondWithFilteredResult(_0x4aa2a9,_0x55a16b){return function(_0x5501ba){if(_0x5501ba){var _0x1cd501=typeof _0x55a16b[_0xf439('0x1d')]===_0xf439('0x1e')&&typeof _0x55a16b[_0xf439('0x1f')]===_0xf439('0x1e');var _0x3c959c=_0x5501ba[_0xf439('0x20')];var _0x1d4964=_0x1cd501?0x0:_0x55a16b[_0xf439('0x1d')];var _0x143a26=_0x1cd501?_0x5501ba[_0xf439('0x20')]:_0x55a16b['offset']+_0x55a16b[_0xf439('0x1f')];var _0x136e79;if(_0x143a26>=_0x3c959c){_0x143a26=_0x3c959c;_0x136e79=0xc8;}else{_0x136e79=0xce;}_0x4aa2a9[_0xf439('0x1c')](_0x136e79);return _0x4aa2a9['set']('Content-Range',_0x1d4964+'-'+_0x143a26+'/'+_0x3c959c)[_0xf439('0x21')](_0x5501ba);}return null;};}function patchUpdates(_0x3178ef){return function(_0x15789d){try{jsonpatch[_0xf439('0x22')](_0x15789d,_0x3178ef,!![]);}catch(_0x3cd567){return BPromise['reject'](_0x3cd567);}return _0x15789d[_0xf439('0x23')]();};}function saveUpdates(_0x46a348,_0x37ecd7){return function(_0x51d2f2){if(_0x51d2f2){return _0x51d2f2[_0xf439('0x24')](_0x46a348)['then'](function(_0x5cbe8b){return _0x5cbe8b;});}return null;};}function removeEntity(_0xa28ba0,_0x266bf9){return function(_0x700b5f){if(_0x700b5f){return _0x700b5f['destroy']()[_0xf439('0x25')](function(){_0xa28ba0[_0xf439('0x1c')](0xcc)[_0xf439('0x26')]();});}};}function handleEntityNotFound(_0x25bd92,_0xd3ee92){return function(_0x1687bc){if(!_0x1687bc){_0x25bd92[_0xf439('0x27')](0x194);}return _0x1687bc;};}function handleError(_0x400996,_0x1bbc67){_0x1bbc67=_0x1bbc67||0x1f4;return function(_0x18c808){logger[_0xf439('0x28')](_0x18c808['stack']);if(_0x18c808['name']){delete _0x18c808['name'];}_0x400996[_0xf439('0x1c')](_0x1bbc67)[_0xf439('0x29')](_0x18c808);};}exports[_0xf439('0x2a')]=function(_0x42f688,_0x291229){var _0x37878e={},_0x1918fe={},_0x25cf9b={'count':0x0,'rows':[]};var _0x1c0764=_[_0xf439('0x2b')](db[_0xf439('0x2c')][_0xf439('0x2d')],function(_0x2759e1){return{'name':_0x2759e1['fieldName'],'type':_0x2759e1[_0xf439('0x2e')][_0xf439('0x2f')]};});_0x1918fe[_0xf439('0x30')]=_[_0xf439('0x2b')](_0x1c0764,_0xf439('0x31'));_0x1918fe['query']=_['keys'](_0x42f688[_0xf439('0x32')]);_0x1918fe[_0xf439('0x33')]=_[_0xf439('0x34')](_0x1918fe[_0xf439('0x30')],_0x1918fe[_0xf439('0x32')]);_0x37878e[_0xf439('0x35')]=_[_0xf439('0x34')](_0x1918fe[_0xf439('0x30')],qs[_0xf439('0x36')](_0x42f688[_0xf439('0x32')][_0xf439('0x36')]));_0x37878e[_0xf439('0x35')]=_0x37878e[_0xf439('0x35')][_0xf439('0x37')]?_0x37878e[_0xf439('0x35')]:_0x1918fe[_0xf439('0x30')];if(!_0x42f688[_0xf439('0x32')][_0xf439('0x38')]('nolimit')){_0x37878e[_0xf439('0x1f')]=qs[_0xf439('0x1f')](_0x42f688[_0xf439('0x32')][_0xf439('0x1f')]);_0x37878e[_0xf439('0x1d')]=qs['offset'](_0x42f688['query']['offset']);}_0x37878e[_0xf439('0x39')]=qs[_0xf439('0x3a')](_0x42f688['query'][_0xf439('0x3a')]);_0x37878e[_0xf439('0x3b')]=qs['filters'](_['pick'](_0x42f688[_0xf439('0x32')],_0x1918fe['filters']),_0x1c0764);if(_0x42f688['query'][_0xf439('0x3c')]){_0x37878e[_0xf439('0x3b')]=_[_0xf439('0x3d')](_0x37878e[_0xf439('0x3b')],{'$or':_[_0xf439('0x2b')](_0x1c0764,function(_0x36bd4f){if(_0x36bd4f[_0xf439('0x2e')]!==_0xf439('0x3e')){var _0x4bee19={};_0x4bee19[_0x36bd4f[_0xf439('0x31')]]={'$like':'%'+_0x42f688[_0xf439('0x32')]['filter']+'%'};return _0x4bee19;}})});}_0x37878e=_[_0xf439('0x3d')]({},_0x37878e,_0x42f688[_0xf439('0x3f')]);var _0x2755b7={'where':_0x37878e[_0xf439('0x3b')]};return db['SalesforceAccount']['count'](_0x2755b7)[_0xf439('0x25')](function(_0x309622){_0x25cf9b[_0xf439('0x20')]=_0x309622;if(_0x42f688[_0xf439('0x32')]['includeAll']){_0x37878e[_0xf439('0x40')]=[{'all':!![]}];}return db[_0xf439('0x2c')]['findAll'](_0x37878e);})['then'](function(_0x1f8667){_0x25cf9b[_0xf439('0x41')]=_0x1f8667;return _0x25cf9b;})[_0xf439('0x25')](respondWithFilteredResult(_0x291229,_0x37878e))['catch'](handleError(_0x291229,null));};exports[_0xf439('0x42')]=function(_0x42eadc,_0x5b3773){var _0x1f2f40={'raw':![],'where':{'id':_0x42eadc[_0xf439('0x43')]['id']}},_0x1f4d04={};_0x1f4d04['model']=_[_0xf439('0x44')](db[_0xf439('0x2c')][_0xf439('0x2d')]);_0x1f4d04[_0xf439('0x32')]=_['keys'](_0x42eadc[_0xf439('0x32')]);_0x1f4d04[_0xf439('0x33')]=_[_0xf439('0x34')](_0x1f4d04[_0xf439('0x30')],_0x1f4d04[_0xf439('0x32')]);_0x1f2f40[_0xf439('0x35')]=_[_0xf439('0x34')](_0x1f4d04[_0xf439('0x30')],qs['fields'](_0x42eadc[_0xf439('0x32')][_0xf439('0x36')]));_0x1f2f40[_0xf439('0x35')]=_0x1f2f40['attributes'][_0xf439('0x37')]?_0x1f2f40[_0xf439('0x35')]:_0x1f4d04[_0xf439('0x30')];if(_0x42eadc[_0xf439('0x32')][_0xf439('0x45')]){_0x1f2f40[_0xf439('0x40')]=[{'all':!![]}];}_0x1f2f40=_[_0xf439('0x3d')]({},_0x1f2f40,_0x42eadc[_0xf439('0x3f')]);return db[_0xf439('0x2c')][_0xf439('0x46')](_0x1f2f40)['then'](handleEntityNotFound(_0x5b3773,null))[_0xf439('0x25')](respondWithResult(_0x5b3773,null))[_0xf439('0x47')](handleError(_0x5b3773,null));};exports[_0xf439('0x48')]=function(_0x3f55ab,_0x5cb2af){return db[_0xf439('0x2c')]['create'](_0x3f55ab['body'],{})['then'](respondWithResult(_0x5cb2af,0xc9))[_0xf439('0x47')](handleError(_0x5cb2af,null));};exports['update']=function(_0x174e52,_0x1cf20d){if(_0x174e52[_0xf439('0x49')]['id']){delete _0x174e52[_0xf439('0x49')]['id'];}return db[_0xf439('0x2c')][_0xf439('0x46')]({'where':{'id':_0x174e52[_0xf439('0x43')]['id']}})[_0xf439('0x25')](handleEntityNotFound(_0x1cf20d,null))[_0xf439('0x25')](saveUpdates(_0x174e52[_0xf439('0x49')],null))[_0xf439('0x25')](respondWithResult(_0x1cf20d,null))[_0xf439('0x47')](handleError(_0x1cf20d,null));};exports['destroy']=function(_0x24db11,_0x2f4b3a){return db[_0xf439('0x2c')]['find']({'where':{'id':_0x24db11[_0xf439('0x43')]['id']}})[_0xf439('0x25')](handleEntityNotFound(_0x2f4b3a,null))[_0xf439('0x25')](removeEntity(_0x2f4b3a,null))['catch'](handleError(_0x2f4b3a,null));};exports[_0xf439('0x4a')]=function(_0x551bac,_0x338bf0,_0x31f400){var _0x43492e={};var _0x59c5eb={};var _0x59017a;var _0x59d85f;return db[_0xf439('0x2c')][_0xf439('0x4b')]({'where':{'id':_0x551bac[_0xf439('0x43')]['id']}})[_0xf439('0x25')](handleEntityNotFound(_0x338bf0,null))[_0xf439('0x25')](function(_0x37b71d){if(_0x37b71d){_0x59017a=_0x37b71d;_0x59c5eb[_0xf439('0x30')]=_[_0xf439('0x44')](db[_0xf439('0x4c')][_0xf439('0x2d')]);_0x59c5eb[_0xf439('0x32')]=_[_0xf439('0x44')](_0x551bac[_0xf439('0x32')]);_0x59c5eb[_0xf439('0x33')]=_[_0xf439('0x34')](_0x59c5eb[_0xf439('0x30')],_0x59c5eb[_0xf439('0x32')]);_0x43492e['attributes']=_[_0xf439('0x34')](_0x59c5eb['model'],qs['fields'](_0x551bac[_0xf439('0x32')][_0xf439('0x36')]));_0x43492e[_0xf439('0x35')]=_0x43492e['attributes']['length']?_0x43492e[_0xf439('0x35')]:_0x59c5eb['model'];_0x43492e['order']=qs[_0xf439('0x3a')](_0x551bac[_0xf439('0x32')][_0xf439('0x3a')]);_0x43492e[_0xf439('0x3b')]=qs['filters'](_[_0xf439('0x4d')](_0x551bac[_0xf439('0x32')],_0x59c5eb['filters']));if(_0x551bac[_0xf439('0x32')][_0xf439('0x3c')]){_0x43492e[_0xf439('0x3b')]=_['merge'](_0x43492e[_0xf439('0x3b')],{'$or':_[_0xf439('0x2b')](_0x43492e['attributes'],function(_0x4b7931){var _0x52c7d0={};_0x52c7d0[_0x4b7931]={'$like':'%'+_0x551bac[_0xf439('0x32')][_0xf439('0x3c')]+'%'};return _0x52c7d0;})});}_0x43492e=_[_0xf439('0x3d')]({},_0x43492e,_0x551bac[_0xf439('0x3f')]);return _0x59017a[_0xf439('0x4a')](_0x43492e);}})[_0xf439('0x25')](function(_0x29bc19){if(_0x29bc19){_0x59d85f=_0x29bc19[_0xf439('0x37')];if(!_0x551bac[_0xf439('0x32')][_0xf439('0x38')](_0xf439('0x4e'))){_0x43492e['limit']=qs[_0xf439('0x1f')](_0x551bac[_0xf439('0x32')]['limit']);_0x43492e['offset']=qs['offset'](_0x551bac[_0xf439('0x32')][_0xf439('0x1d')]);}return _0x59017a['getConfigurations'](_0x43492e);}})[_0xf439('0x25')](function(_0x43e7f3){if(_0x43e7f3){return _0x43e7f3?{'count':_0x59d85f,'rows':_0x43e7f3}:null;}})[_0xf439('0x25')](respondWithResult(_0x338bf0,null))[_0xf439('0x47')](handleError(_0x338bf0,null));};exports[_0xf439('0x4f')]=function(_0x598a34,_0x45667e,_0x1bdbd5){if(_0x598a34['body']['id']){delete _0x598a34[_0xf439('0x49')]['id'];}return db[_0xf439('0x2c')]['findOne']({'where':{'id':_0x598a34[_0xf439('0x43')]['id']}})[_0xf439('0x25')](handleEntityNotFound(_0x45667e,null))[_0xf439('0x25')](function(_0x113003){if(_0x113003){_0x598a34['body'][_0xf439('0x50')]=_0x113003['id'];_0x598a34[_0xf439('0x49')][_0xf439('0x51')]=integrations['getSubjects'](_0x598a34[_0xf439('0x49')][_0xf439('0x52')],_0x598a34[_0xf439('0x49')][_0xf439('0x2e')]);_0x598a34[_0xf439('0x49')][_0xf439('0x53')]=integrations[_0xf439('0x54')](_0x598a34[_0xf439('0x49')]['channel'],_0x598a34['body'][_0xf439('0x2e')]);return db[_0xf439('0x4c')][_0xf439('0x48')](_0x598a34[_0xf439('0x49')],{'include':[{'model':db[_0xf439('0x55')],'as':_0xf439('0x51')},{'model':db[_0xf439('0x55')],'as':_0xf439('0x53')}]});}return null;})[_0xf439('0x25')](respondWithResult(_0x45667e,null))['catch'](handleError(_0x45667e,null));};exports['getFields']=function(_0x509650,_0x2da685,_0xc192d9){var _0x35feb3;var _0x470a2a='';var _0x47d457='Task';return db[_0xf439('0x2c')][_0xf439('0x4b')]({'where':{'id':_0x509650[_0xf439('0x43')]['id']},'attributes':['id',_0xf439('0x56'),'clientId',_0xf439('0x57'),_0xf439('0x58'),'password',_0xf439('0x59')]})[_0xf439('0x25')](handleEntityNotFound(_0x2da685,null))[_0xf439('0x25')](function(_0x44bce2){if(_0x44bce2){_0x470a2a=_0x44bce2['remoteUri'];var _0x2ca146=_0x470a2a[_0xf439('0x5a')](-0x1);if(_0x2ca146==='/'){_0x470a2a=_0x470a2a[_0xf439('0x5b')](0x0,_0x470a2a[_0xf439('0x5c')](_0x2ca146));}_0x35feb3=new jsforce[(_0xf439('0x5d'))]({'oauth2':{'loginUrl':_0x470a2a,'clientId':_0x44bce2[_0xf439('0x5e')],'clientSecret':_0x44bce2[_0xf439('0x57')]}});return _0x35feb3[_0xf439('0x5f')](_0x44bce2[_0xf439('0x58')],_0x44bce2[_0xf439('0x60')][_0xf439('0x61')](_0x44bce2[_0xf439('0x59')]));}})[_0xf439('0x25')](function(_0x580c65){if(_0x580c65){if(!_[_0xf439('0x62')](_0x509650[_0xf439('0x32')][_0xf439('0x63')])){_0x47d457=_0x509650[_0xf439('0x32')][_0xf439('0x63')];}return _0x35feb3[_0xf439('0x64')](_0x47d457)[_0xf439('0x65')]();}})[_0xf439('0x25')](function(_0x2b695e){var _0x455baf=[_0xf439('0x66'),_0xf439('0x67'),_0xf439('0x68'),_0xf439('0x69'),_0xf439('0x6a'),'Description'];var _0x52711a=[_0xf439('0x6b'),_0xf439('0x6c'),_0xf439('0x6d'),'boolean',_0xf439('0x6e'),'textarea',_0xf439('0x6f')];if(_0x2b695e){_[_0xf439('0x70')](_0x2b695e['fields'],function(_0xe7d2ad){return _0x455baf[_0xf439('0x71')](_0xe7d2ad['name'])||!_0x52711a[_0xf439('0x71')](_0xe7d2ad['type']);});return{'count':_0x2b695e[_0xf439('0x36')][_0xf439('0x37')],'rows':_['map'](_0x2b695e[_0xf439('0x36')],function(_0x51986a){return{'id':_0x51986a[_0xf439('0x31')],'name':_0x51986a[_0xf439('0x72')],'custom':_0x51986a[_0xf439('0x73')],'options':_0x51986a[_0xf439('0x74')]['length']>0x0?_[_0xf439('0x2b')](_0x51986a[_0xf439('0x74')],function(_0x2694a1){return{'name':_0x2694a1[_0xf439('0x72')],'value':_0x2694a1['value']};}):_0x51986a[_0xf439('0x2e')]==_0xf439('0x75')?[{'name':_0xf439('0x76'),'value':'true'},{'name':_0xf439('0x77'),'value':_0xf439('0x78')}]:[]};})};}})[_0xf439('0x25')](respondWithResult(_0x2da685,null))[_0xf439('0x47')](function(_0x435074){var _0x2c4c86=_0x509650['query'][_0xf439('0x79')]?0x1f4:_0x435074[_0xf439('0x7a')]||0x1f4;logger[_0xf439('0x28')](_0xf439('0x7b'),_0xf439('0x7c'),_0x2c4c86,JSON[_0xf439('0x7d')](_0x435074));delete _0x435074[_0xf439('0x31')];if(_0x2c4c86===0x191){_0x2c4c86=0x190;}_0x2da685['status'](_0x2c4c86)[_0xf439('0x29')](_0x509650['query'][_0xf439('0x79')]?{'message':_0xf439('0x7e'),'statusCode':_0x435074[_0xf439('0x7a')]}:_0x435074);});};
\ No newline at end of file