Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / intFreshdeskAccount / intFreshdeskAccount.controller.js
index ef57ceb..bf241bb 100644 (file)
@@ -1 +1 @@
-const a255_0x1739=['from','custom_dropdown','update','where','../../components/parsers/qs','test','label','includes','name','format','length','channel','sendStatus','apiKey','getConfigurations','limit','attributes','error','count','include','../../mysqldb','Descriptions','FreshdeskField','statusCode','catch','Subjects','choices','includeAll','agent','filter','subject','keys','slice','rawAttributes','FreshdeskConfiguration','priority','json','api','body','findOne','getSubjects','Content-Range','VIRTUAL','intersection','nolimit','capitalize','GET','getFields','status','create','like','send','order','pick','model','stack','destroy','then','merge','Basic\x20%s','rows','lodash','request-promise-native','source','map','offset','params','key','substring','type','AccountId','toString','%s:X','addConfiguration','../../components/integrations/configuration','sequelize','query','%s/%s','../../config/logger','group','undefined','findAll','show','remoteUri','FreshdeskAccount','requester','getFields,\x20%s,\x20%s,\x20%s','sort','default','fields','description','options','filters','Wrong\x20credentials','remove'];(function(_0x18697e,_0x173994){const _0x1ffb1b=function(_0x459ada){while(--_0x459ada){_0x18697e['push'](_0x18697e['shift']());}};_0x1ffb1b(++_0x173994);}(a255_0x1739,0x1af));const a255_0x1ffb=function(_0x18697e,_0x173994){_0x18697e=_0x18697e-0x0;let _0x1ffb1b=a255_0x1739[_0x18697e];return _0x1ffb1b;};const _0x12b779=a255_0x1ffb;'use strict';const rp=require(_0x12b779('0xb')),util=require('util'),_=require(_0x12b779('0xa')),qs=require(_0x12b779('0x30')),logger=require(_0x12b779('0x1b'))(_0x12b779('0x51')),db=require(_0x12b779('0x40'))['db'],{Op}=require(_0x12b779('0x18')),integrations=require(_0x12b779('0x17'));function respondWithResult(_0x459ada,_0xea8d49){return _0xea8d49=_0xea8d49||0xc8,function(_0x2f6187){const _0x40dbbc=a255_0x1ffb;if(_0x2f6187)return _0x459ada['status'](_0xea8d49)[_0x40dbbc('0x50')](_0x2f6187);};}function respondWithFilteredResult(_0x28171b,_0x1eaee3){return function(_0x54623b){const _0x119136=a255_0x1ffb;if(_0x54623b){const _0x1ff679=_0x54623b[_0x119136('0x3e')],_0x376e3e=_0x1eaee3['offset'];let _0x16dc31=_0x1eaee3[_0x119136('0xe')]+_0x1eaee3[_0x119136('0x3b')],_0x3a395c;return _0x16dc31>=_0x1ff679?(_0x16dc31=_0x1ff679,_0x3a395c=0xc8):_0x3a395c=0xce,_0x28171b[_0x119136('0x5c')](_0x3a395c),_0x28171b['set'](_0x119136('0x55'),_0x376e3e+'-'+_0x16dc31+'/'+_0x1ff679)[_0x119136('0x50')](_0x54623b);}return null;};}function saveUpdates(_0x12dfac){return function(_0x18ae82){const _0x11a375=a255_0x1ffb;if(_0x18ae82)return _0x18ae82['update'](_0x12dfac)[_0x11a375('0x6')](function(_0x7fb4dd){return _0x7fb4dd;});return null;};}function removeEntity(_0x3c4761){return function(_0x3ee4f1){const _0x19455b=a255_0x1ffb;if(_0x3ee4f1)return _0x3ee4f1[_0x19455b('0x5')]()[_0x19455b('0x6')](function(){const _0x1b5550=_0x19455b;_0x3c4761[_0x1b5550('0x5c')](0xcc)['end']();});};}function handleEntityNotFound(_0x489215){return function(_0x3dde0f){const _0x3f842f=a255_0x1ffb;return!_0x3dde0f&&_0x489215[_0x3f842f('0x38')](0x194),_0x3dde0f;};}function handleError(_0xe8907a,_0x5979f6){return _0x5979f6=_0x5979f6||0x1f4,function(_0x48fe7e){const _0x16b4f7=a255_0x1ffb;logger[_0x16b4f7('0x3d')](_0x48fe7e[_0x16b4f7('0x4')]),_0x48fe7e['name']&&delete _0x48fe7e[_0x16b4f7('0x34')],_0xe8907a[_0x16b4f7('0x5c')](_0x5979f6)[_0x16b4f7('0x0')](_0x48fe7e);};}exports['index']=function(_0x2fae5f,_0x582b62){const _0x3edbfe=_0x12b779;let _0x163783={};const _0x24d495={},_0x18568d={'count':0x0,'rows':[]},_0x2423a3=_[_0x3edbfe('0xd')](db['FreshdeskAccount'][_0x3edbfe('0x4d')],function(_0x39c2c4){const _0x3b8348=_0x3edbfe;return{'name':_0x39c2c4['fieldName'],'type':_0x39c2c4['type'][_0x3b8348('0x10')]};});_0x24d495[_0x3edbfe('0x3')]=_['map'](_0x2423a3,_0x3edbfe('0x34')),_0x24d495['query']=_[_0x3edbfe('0x4b')](_0x2fae5f['query']),_0x24d495[_0x3edbfe('0x29')]=_[_0x3edbfe('0x57')](_0x24d495[_0x3edbfe('0x3')],_0x24d495[_0x3edbfe('0x19')]),_0x163783['attributes']=_[_0x3edbfe('0x57')](_0x24d495[_0x3edbfe('0x3')],qs[_0x3edbfe('0x26')](_0x2fae5f[_0x3edbfe('0x19')][_0x3edbfe('0x26')])),_0x163783[_0x3edbfe('0x3c')]=_0x163783[_0x3edbfe('0x3c')][_0x3edbfe('0x36')]?_0x163783[_0x3edbfe('0x3c')]:_0x24d495[_0x3edbfe('0x3')];typeof _0x2fae5f['query'][_0x3edbfe('0x58')]==='undefined'&&(_0x163783['limit']=qs['limit'](_0x2fae5f[_0x3edbfe('0x19')]['limit']),_0x163783[_0x3edbfe('0xe')]=qs[_0x3edbfe('0xe')](_0x2fae5f[_0x3edbfe('0x19')][_0x3edbfe('0xe')]));_0x163783[_0x3edbfe('0x1')]=qs[_0x3edbfe('0x24')](_0x2fae5f['query'][_0x3edbfe('0x24')]),_0x163783['where']=qs['filters'](_[_0x3edbfe('0x2')](_0x2fae5f[_0x3edbfe('0x19')],_0x24d495['filters']),_0x2423a3);_0x2fae5f[_0x3edbfe('0x19')]['filter']&&(_0x163783[_0x3edbfe('0x2f')]=_[_0x3edbfe('0x7')](_0x163783[_0x3edbfe('0x2f')],{[Op['or']]:_[_0x3edbfe('0xd')](_0x2423a3,function(_0x1a3be3){const _0x1273af=_0x3edbfe;if(_0x1a3be3['type']!==_0x1273af('0x56')){const _0x15611f={};return _0x15611f[_0x1a3be3['name']]={[Op[_0x1273af('0x5e')]]:'%'+_0x2fae5f['query'][_0x1273af('0x49')]+'%'},_0x15611f;}})}));_0x163783=_[_0x3edbfe('0x7')]({},_0x163783,_0x2fae5f[_0x3edbfe('0x28')]);const _0x100af8={'where':_0x163783[_0x3edbfe('0x2f')]};return db[_0x3edbfe('0x21')][_0x3edbfe('0x3e')](_0x100af8)[_0x3edbfe('0x6')](function(_0x409a06){const _0x29dd57=_0x3edbfe;return _0x18568d[_0x29dd57('0x3e')]=_0x409a06,_0x2fae5f[_0x29dd57('0x19')][_0x29dd57('0x47')]&&(_0x163783[_0x29dd57('0x3f')]=[{'all':!![]}]),db[_0x29dd57('0x21')][_0x29dd57('0x1e')](_0x163783);})[_0x3edbfe('0x6')](function(_0xbf8d95){const _0x54be17=_0x3edbfe;return _0x18568d[_0x54be17('0x9')]=_0xbf8d95,_0x18568d;})[_0x3edbfe('0x6')](respondWithFilteredResult(_0x582b62,_0x163783))[_0x3edbfe('0x44')](handleError(_0x582b62,null));},exports[_0x12b779('0x1f')]=function(_0x2f4e5f,_0x14d719){const _0x2127eb=_0x12b779;let _0x1e32ce={'raw':![],'where':{'id':_0x2f4e5f[_0x2127eb('0xf')]['id']}};const _0x38af37={};return _0x38af37[_0x2127eb('0x3')]=_[_0x2127eb('0x4b')](db[_0x2127eb('0x21')][_0x2127eb('0x4d')]),_0x38af37[_0x2127eb('0x19')]=_[_0x2127eb('0x4b')](_0x2f4e5f[_0x2127eb('0x19')]),_0x38af37[_0x2127eb('0x29')]=_[_0x2127eb('0x57')](_0x38af37[_0x2127eb('0x3')],_0x38af37[_0x2127eb('0x19')]),_0x1e32ce[_0x2127eb('0x3c')]=_[_0x2127eb('0x57')](_0x38af37[_0x2127eb('0x3')],qs[_0x2127eb('0x26')](_0x2f4e5f['query']['fields'])),_0x1e32ce[_0x2127eb('0x3c')]=_0x1e32ce[_0x2127eb('0x3c')][_0x2127eb('0x36')]?_0x1e32ce['attributes']:_0x38af37['model'],_0x2f4e5f[_0x2127eb('0x19')][_0x2127eb('0x47')]&&(_0x1e32ce[_0x2127eb('0x3f')]=[{'all':!![]}]),_0x1e32ce=_[_0x2127eb('0x7')]({},_0x1e32ce,_0x2f4e5f['options']),db[_0x2127eb('0x21')][_0x2127eb('0x53')](_0x1e32ce)[_0x2127eb('0x6')](handleEntityNotFound(_0x14d719,null))[_0x2127eb('0x6')](respondWithResult(_0x14d719,null))[_0x2127eb('0x44')](handleError(_0x14d719,null));},exports[_0x12b779('0x5d')]=function(_0x2a0ee5,_0x4954e5){const _0x492dd8=_0x12b779;return db['FreshdeskAccount'][_0x492dd8('0x5d')](_0x2a0ee5[_0x492dd8('0x52')],{})[_0x492dd8('0x6')](respondWithResult(_0x4954e5,0xc9))['catch'](handleError(_0x4954e5,null));},exports[_0x12b779('0x2e')]=function(_0x36a538,_0x28190){const _0x2eb2e7=_0x12b779;return _0x36a538[_0x2eb2e7('0x52')]['id']&&delete _0x36a538['body']['id'],db['FreshdeskAccount'][_0x2eb2e7('0x53')]({'where':{'id':_0x36a538['params']['id']}})[_0x2eb2e7('0x6')](handleEntityNotFound(_0x28190,null))[_0x2eb2e7('0x6')](saveUpdates(_0x36a538['body'],null))[_0x2eb2e7('0x6')](respondWithResult(_0x28190,null))['catch'](handleError(_0x28190,null));},exports['destroy']=function(_0x7181c0,_0x451ec8){const _0x3a49c2=_0x12b779;return db[_0x3a49c2('0x21')][_0x3a49c2('0x53')]({'where':{'id':_0x7181c0['params']['id']}})['then'](handleEntityNotFound(_0x451ec8,null))['then'](removeEntity(_0x451ec8,null))[_0x3a49c2('0x44')](handleError(_0x451ec8,null));},exports[_0x12b779('0x3a')]=function(_0x5c7b3b,_0x1b0a08){const _0x537fd2=_0x12b779;let _0x18cae5={};const _0x565250={};let _0x272acc,_0x5964d0;return db[_0x537fd2('0x21')][_0x537fd2('0x53')]({'where':{'id':_0x5c7b3b['params']['id']}})[_0x537fd2('0x6')](handleEntityNotFound(_0x1b0a08,null))[_0x537fd2('0x6')](function(_0x4f7d2d){const _0x1981ed=_0x537fd2;if(_0x4f7d2d)return _0x272acc=_0x4f7d2d,_0x565250[_0x1981ed('0x3')]=_[_0x1981ed('0x4b')](db[_0x1981ed('0x4e')][_0x1981ed('0x4d')]),_0x565250['query']=_[_0x1981ed('0x4b')](_0x5c7b3b[_0x1981ed('0x19')]),_0x565250[_0x1981ed('0x29')]=_['intersection'](_0x565250[_0x1981ed('0x3')],_0x565250['query']),_0x18cae5[_0x1981ed('0x3c')]=_[_0x1981ed('0x57')](_0x565250[_0x1981ed('0x3')],qs[_0x1981ed('0x26')](_0x5c7b3b['query'][_0x1981ed('0x26')])),_0x18cae5[_0x1981ed('0x3c')]=_0x18cae5[_0x1981ed('0x3c')][_0x1981ed('0x36')]?_0x18cae5[_0x1981ed('0x3c')]:_0x565250['model'],_0x18cae5[_0x1981ed('0x1')]=qs['sort'](_0x5c7b3b[_0x1981ed('0x19')][_0x1981ed('0x24')]),_0x18cae5[_0x1981ed('0x2f')]=qs[_0x1981ed('0x29')](_[_0x1981ed('0x2')](_0x5c7b3b['query'],_0x565250[_0x1981ed('0x29')])),_0x5c7b3b[_0x1981ed('0x19')][_0x1981ed('0x49')]&&(_0x18cae5[_0x1981ed('0x2f')]=_[_0x1981ed('0x7')](_0x18cae5[_0x1981ed('0x2f')],{[Op['or']]:_[_0x1981ed('0xd')](_0x18cae5['attributes'],function(_0x217a25){const _0x1ccd2a=_0x1981ed,_0xbb242a={};return _0xbb242a[_0x217a25]={[Op[_0x1ccd2a('0x5e')]]:'%'+_0x5c7b3b[_0x1ccd2a('0x19')][_0x1ccd2a('0x49')]+'%'},_0xbb242a;})})),_0x18cae5=_['merge']({},_0x18cae5,_0x5c7b3b[_0x1981ed('0x28')]),_0x272acc[_0x1981ed('0x3a')](_0x18cae5);})[_0x537fd2('0x6')](function(_0x535239){const _0x1ae784=_0x537fd2;if(_0x535239)return _0x5964d0=_0x535239['length'],typeof _0x5c7b3b[_0x1ae784('0x19')][_0x1ae784('0x58')]===_0x1ae784('0x1d')&&(_0x18cae5['limit']=qs[_0x1ae784('0x3b')](_0x5c7b3b[_0x1ae784('0x19')]['limit']),_0x18cae5[_0x1ae784('0xe')]=qs[_0x1ae784('0xe')](_0x5c7b3b['query'][_0x1ae784('0xe')])),_0x272acc[_0x1ae784('0x3a')](_0x18cae5);})[_0x537fd2('0x6')](function(_0x57f7fe){if(_0x57f7fe)return _0x57f7fe?{'count':_0x5964d0,'rows':_0x57f7fe}:null;})[_0x537fd2('0x6')](respondWithResult(_0x1b0a08,null))['catch'](handleError(_0x1b0a08,null));},exports[_0x12b779('0x16')]=function(_0x4dc51b,_0x3d83f4){const _0x5296a6=_0x12b779;return _0x4dc51b[_0x5296a6('0x52')]['id']&&delete _0x4dc51b[_0x5296a6('0x52')]['id'],db[_0x5296a6('0x21')]['findOne']({'where':{'id':_0x4dc51b[_0x5296a6('0xf')]['id']}})[_0x5296a6('0x6')](handleEntityNotFound(_0x3d83f4,null))[_0x5296a6('0x6')](function(_0x3a551f){const _0x13c2a7=_0x5296a6;if(_0x3a551f)return _0x4dc51b['body'][_0x13c2a7('0x13')]=_0x3a551f['id'],_0x4dc51b[_0x13c2a7('0x52')]['Subjects']=integrations[_0x13c2a7('0x54')](_0x4dc51b['body']['channel'],_0x4dc51b[_0x13c2a7('0x52')][_0x13c2a7('0x12')]),_0x4dc51b[_0x13c2a7('0x52')][_0x13c2a7('0x41')]=integrations['getDescriptions'](_0x4dc51b[_0x13c2a7('0x52')][_0x13c2a7('0x37')],_0x4dc51b[_0x13c2a7('0x52')][_0x13c2a7('0x12')]),db[_0x13c2a7('0x4e')]['create'](_0x4dc51b[_0x13c2a7('0x52')],{'include':[{'model':db[_0x13c2a7('0x42')],'as':_0x13c2a7('0x45')},{'model':db[_0x13c2a7('0x42')],'as':_0x13c2a7('0x41')}]});return null;})[_0x5296a6('0x6')](respondWithResult(_0x3d83f4,null))[_0x5296a6('0x44')](handleError(_0x3d83f4,null));},exports[_0x12b779('0x5b')]=function(_0x5658f6,_0x4659a4){const _0x30c462=_0x12b779;let _0x1867fd='';return db[_0x30c462('0x21')]['findOne']({'where':{'id':_0x5658f6['params']['id']},'attributes':['id','remoteUri',_0x30c462('0x39')]})[_0x30c462('0x6')](handleEntityNotFound(_0x4659a4,null))[_0x30c462('0x6')](function(_0x572907){const _0x51fe4b=_0x30c462;if(_0x572907){_0x1867fd=_0x572907[_0x51fe4b('0x20')];const _0x36e60c=_0x1867fd[_0x51fe4b('0x4c')](-0x1);return _0x36e60c==='/'&&(_0x1867fd=_0x1867fd[_0x51fe4b('0x11')](0x0,_0x1867fd['lastIndexOf'](_0x36e60c))),rp({'method':_0x51fe4b('0x5a'),'uri':util[_0x51fe4b('0x35')](_0x51fe4b('0x1a'),_0x1867fd,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0x51fe4b('0x8'),Buffer[_0x51fe4b('0x2c')](util[_0x51fe4b('0x35')](_0x51fe4b('0x15'),_0x572907[_0x51fe4b('0x39')]))[_0x51fe4b('0x14')]('base64'))},'json':!![]});}})['then'](function(_0x1d1939){const _0x278d5e=_0x30c462;if(_0x1d1939){const _0x173b9c=[_0x278d5e('0x22'),_0x278d5e('0x4a'),_0x278d5e('0x48'),_0x278d5e('0x27'),_0x278d5e('0x5c'),_0x278d5e('0x4f'),_0x278d5e('0x1c'),_0x278d5e('0xc'),'ticket_type',_0x278d5e('0x1c'),'company'];return _[_0x278d5e('0x2b')](_0x1d1939,function(_0x1e536f){const _0x17c566=_0x278d5e;return _0x173b9c[_0x17c566('0x33')](_0x1e536f[_0x17c566('0x34')])||!_0x1e536f[_0x17c566('0x25')]&&_0x1e536f[_0x17c566('0x12')]!=='custom_text'&&_0x1e536f[_0x17c566('0x12')]!==_0x17c566('0x2d');}),{'count':_0x1d1939[_0x278d5e('0x36')],'rows':_['map'](_0x1d1939,function(_0xbd264c){const _0x2ddae7=_0x278d5e;return{'id':_0xbd264c[_0x2ddae7('0x34')],'name':_0xbd264c[_0x2ddae7('0x32')],'custom':!_0xbd264c[_0x2ddae7('0x25')],'options':_0xbd264c[_0x2ddae7('0x46')]?_['map'](_0xbd264c[_0x2ddae7('0x46')],function(_0xfb12e1){const _0x36c7c1=_0x2ddae7;return{'name':_[_0x36c7c1('0x59')](_0xfb12e1),'value':_0xfb12e1};}):[]};})};}})[_0x30c462('0x6')](respondWithResult(_0x4659a4,null))[_0x30c462('0x44')](function(_0x3cff2e){const _0x162f7f=_0x30c462;let _0x2b3aeb=_0x5658f6[_0x162f7f('0x19')][_0x162f7f('0x31')]?0x1f4:_0x3cff2e[_0x162f7f('0x43')]||0x1f4;logger[_0x162f7f('0x3d')](_0x162f7f('0x23'),_0x162f7f('0x5b'),_0x2b3aeb,JSON['stringify'](_0x3cff2e)),delete _0x3cff2e[_0x162f7f('0x34')],_0x2b3aeb===0x191&&(_0x2b3aeb=0x190),_0x4659a4['status'](_0x2b3aeb)[_0x162f7f('0x0')](_0x5658f6[_0x162f7f('0x19')][_0x162f7f('0x31')]?{'message':_0x162f7f('0x2a'),'statusCode':_0x3cff2e[_0x162f7f('0x43')]}:_0x3cff2e);});};
\ No newline at end of file
+const a255_0x16f6=['nolimit','remove','model','remoteUri','attributes','getConfigurations','%s/%s','getFields','length','type','slice','key','offset','send','stack','toString','api/v2/ticket_fields','count','GET','query','where','merge','fieldName','apiKey','ticket_type','from','api','fields','order','priority','../../components/integrations/configuration','Descriptions','sequelize','sort','getFields,\x20%s,\x20%s,\x20%s','FreshdeskConfiguration','includeAll','keys','rows','base64','like','getSubjects','error','set','include','includes','choices','FreshdeskAccount','rawAttributes','index','FreshdeskField','status','Subjects','source','Wrong\x20credentials','options','description','end','json','channel','../../config/logger','requester','custom_text','catch','undefined','../../components/parsers/qs','statusCode','format','map','update','../../mysqldb','create','group','findOne','Content-Range','addConfiguration','name','limit','intersection','body','stringify','filters','subject','sendStatus','test','VIRTUAL','label','params','filter','AccountId','custom_dropdown','then'];(function(_0x41d4a1,_0x16f681){const _0x4fecba=function(_0x1adfde){while(--_0x1adfde){_0x41d4a1['push'](_0x41d4a1['shift']());}};_0x4fecba(++_0x16f681);}(a255_0x16f6,0x74));const a255_0x4fec=function(_0x41d4a1,_0x16f681){_0x41d4a1=_0x41d4a1-0x0;let _0x4fecba=a255_0x16f6[_0x41d4a1];return _0x4fecba;};const _0x184f96=a255_0x4fec;'use strict';const rp=require('request-promise-native'),util=require('util'),_=require('lodash'),qs=require(_0x184f96('0x29')),logger=require(_0x184f96('0x24'))(_0x184f96('0x2')),db=require(_0x184f96('0x2e'))['db'],{Op}=require(_0x184f96('0x8')),integrations=require(_0x184f96('0x6'));function respondWithResult(_0x1adfde,_0x6b00fd){return _0x6b00fd=_0x6b00fd||0xc8,function(_0x5aa5a4){const _0x47cd77=a255_0x4fec;if(_0x5aa5a4)return _0x1adfde[_0x47cd77('0x1b')](_0x6b00fd)[_0x47cd77('0x22')](_0x5aa5a4);};}function respondWithFilteredResult(_0x5c0778,_0x3ea0d0){return function(_0x2d9e92){const _0x14699c=a255_0x4fec;if(_0x2d9e92){const _0x82ad40=_0x2d9e92[_0x14699c('0x55')],_0x1b710b=_0x3ea0d0[_0x14699c('0x50')];let _0x2b50d9=_0x3ea0d0[_0x14699c('0x50')]+_0x3ea0d0[_0x14699c('0x35')],_0x105b46;return _0x2b50d9>=_0x82ad40?(_0x2b50d9=_0x82ad40,_0x105b46=0xc8):_0x105b46=0xce,_0x5c0778[_0x14699c('0x1b')](_0x105b46),_0x5c0778[_0x14699c('0x13')](_0x14699c('0x32'),_0x1b710b+'-'+_0x2b50d9+'/'+_0x82ad40)[_0x14699c('0x22')](_0x2d9e92);}return null;};}function saveUpdates(_0x283787){return function(_0x996dc6){const _0x2f93b1=a255_0x4fec;if(_0x996dc6)return _0x996dc6[_0x2f93b1('0x2d')](_0x283787)[_0x2f93b1('0x43')](function(_0x198c4a){return _0x198c4a;});return null;};}function removeEntity(_0x53e204){return function(_0x5835a6){const _0x12850d=a255_0x4fec;if(_0x5835a6)return _0x5835a6['destroy']()[_0x12850d('0x43')](function(){const _0x2fcb17=_0x12850d;_0x53e204[_0x2fcb17('0x1b')](0xcc)[_0x2fcb17('0x21')]();});};}function handleEntityNotFound(_0x3112ad){return function(_0x573da4){const _0x220489=a255_0x4fec;return!_0x573da4&&_0x3112ad[_0x220489('0x3b')](0x194),_0x573da4;};}function handleError(_0xebaaa1,_0x4f625b){return _0x4f625b=_0x4f625b||0x1f4,function(_0x30770b){const _0x4f2ba1=a255_0x4fec;logger['error'](_0x30770b[_0x4f2ba1('0x52')]),_0x30770b['name']&&delete _0x30770b['name'],_0xebaaa1[_0x4f2ba1('0x1b')](_0x4f625b)[_0x4f2ba1('0x51')](_0x30770b);};}exports[_0x184f96('0x19')]=function(_0x3c03e4,_0x4ab1f0){const _0x119860=_0x184f96;let _0x3aa7c3={};const _0x31bf88={},_0x5b81b9={'count':0x0,'rows':[]},_0x51b782=_[_0x119860('0x2c')](db[_0x119860('0x17')]['rawAttributes'],function(_0x5b9171){const _0x57ab88=_0x119860;return{'name':_0x5b9171[_0x57ab88('0x5a')],'type':_0x5b9171['type'][_0x57ab88('0x4f')]};});_0x31bf88[_0x119860('0x46')]=_[_0x119860('0x2c')](_0x51b782,_0x119860('0x34')),_0x31bf88[_0x119860('0x57')]=_[_0x119860('0xd')](_0x3c03e4[_0x119860('0x57')]),_0x31bf88[_0x119860('0x39')]=_[_0x119860('0x36')](_0x31bf88[_0x119860('0x46')],_0x31bf88[_0x119860('0x57')]),_0x3aa7c3[_0x119860('0x48')]=_[_0x119860('0x36')](_0x31bf88[_0x119860('0x46')],qs[_0x119860('0x3')](_0x3c03e4[_0x119860('0x57')]['fields'])),_0x3aa7c3[_0x119860('0x48')]=_0x3aa7c3[_0x119860('0x48')]['length']?_0x3aa7c3[_0x119860('0x48')]:_0x31bf88[_0x119860('0x46')];typeof _0x3c03e4[_0x119860('0x57')]['nolimit']===_0x119860('0x28')&&(_0x3aa7c3['limit']=qs[_0x119860('0x35')](_0x3c03e4[_0x119860('0x57')]['limit']),_0x3aa7c3[_0x119860('0x50')]=qs[_0x119860('0x50')](_0x3c03e4[_0x119860('0x57')][_0x119860('0x50')]));_0x3aa7c3[_0x119860('0x4')]=qs[_0x119860('0x9')](_0x3c03e4[_0x119860('0x57')][_0x119860('0x9')]),_0x3aa7c3[_0x119860('0x58')]=qs[_0x119860('0x39')](_['pick'](_0x3c03e4[_0x119860('0x57')],_0x31bf88[_0x119860('0x39')]),_0x51b782);_0x3c03e4[_0x119860('0x57')]['filter']&&(_0x3aa7c3[_0x119860('0x58')]=_[_0x119860('0x59')](_0x3aa7c3[_0x119860('0x58')],{[Op['or']]:_[_0x119860('0x2c')](_0x51b782,function(_0x51c0d9){const _0x3e4732=_0x119860;if(_0x51c0d9[_0x3e4732('0x4d')]!==_0x3e4732('0x3d')){const _0xd05606={};return _0xd05606[_0x51c0d9[_0x3e4732('0x34')]]={[Op[_0x3e4732('0x10')]]:'%'+_0x3c03e4['query'][_0x3e4732('0x40')]+'%'},_0xd05606;}})}));_0x3aa7c3=_['merge']({},_0x3aa7c3,_0x3c03e4[_0x119860('0x1f')]);const _0x245494={'where':_0x3aa7c3[_0x119860('0x58')]};return db['FreshdeskAccount'][_0x119860('0x55')](_0x245494)['then'](function(_0x3c1847){const _0x53e6d7=_0x119860;return _0x5b81b9['count']=_0x3c1847,_0x3c03e4[_0x53e6d7('0x57')][_0x53e6d7('0xc')]&&(_0x3aa7c3[_0x53e6d7('0x14')]=[{'all':!![]}]),db[_0x53e6d7('0x17')]['findAll'](_0x3aa7c3);})['then'](function(_0x326517){const _0x110a6c=_0x119860;return _0x5b81b9[_0x110a6c('0xe')]=_0x326517,_0x5b81b9;})[_0x119860('0x43')](respondWithFilteredResult(_0x4ab1f0,_0x3aa7c3))['catch'](handleError(_0x4ab1f0,null));},exports['show']=function(_0x3028b0,_0x158cc2){const _0x2bb8ba=_0x184f96;let _0x4ebb07={'raw':![],'where':{'id':_0x3028b0[_0x2bb8ba('0x3f')]['id']}};const _0x114d08={};return _0x114d08['model']=_[_0x2bb8ba('0xd')](db[_0x2bb8ba('0x17')][_0x2bb8ba('0x18')]),_0x114d08['query']=_['keys'](_0x3028b0[_0x2bb8ba('0x57')]),_0x114d08[_0x2bb8ba('0x39')]=_[_0x2bb8ba('0x36')](_0x114d08['model'],_0x114d08[_0x2bb8ba('0x57')]),_0x4ebb07[_0x2bb8ba('0x48')]=_['intersection'](_0x114d08[_0x2bb8ba('0x46')],qs['fields'](_0x3028b0[_0x2bb8ba('0x57')][_0x2bb8ba('0x3')])),_0x4ebb07['attributes']=_0x4ebb07[_0x2bb8ba('0x48')][_0x2bb8ba('0x4c')]?_0x4ebb07[_0x2bb8ba('0x48')]:_0x114d08[_0x2bb8ba('0x46')],_0x3028b0['query']['includeAll']&&(_0x4ebb07[_0x2bb8ba('0x14')]=[{'all':!![]}]),_0x4ebb07=_[_0x2bb8ba('0x59')]({},_0x4ebb07,_0x3028b0[_0x2bb8ba('0x1f')]),db[_0x2bb8ba('0x17')][_0x2bb8ba('0x31')](_0x4ebb07)['then'](handleEntityNotFound(_0x158cc2,null))[_0x2bb8ba('0x43')](respondWithResult(_0x158cc2,null))['catch'](handleError(_0x158cc2,null));},exports['create']=function(_0x2d70de,_0x2c463d){const _0x3c5336=_0x184f96;return db[_0x3c5336('0x17')][_0x3c5336('0x2f')](_0x2d70de[_0x3c5336('0x37')],{})[_0x3c5336('0x43')](respondWithResult(_0x2c463d,0xc9))[_0x3c5336('0x27')](handleError(_0x2c463d,null));},exports[_0x184f96('0x2d')]=function(_0x648813,_0x21ce97){const _0x4609f7=_0x184f96;return _0x648813[_0x4609f7('0x37')]['id']&&delete _0x648813['body']['id'],db[_0x4609f7('0x17')][_0x4609f7('0x31')]({'where':{'id':_0x648813[_0x4609f7('0x3f')]['id']}})[_0x4609f7('0x43')](handleEntityNotFound(_0x21ce97,null))['then'](saveUpdates(_0x648813[_0x4609f7('0x37')],null))[_0x4609f7('0x43')](respondWithResult(_0x21ce97,null))[_0x4609f7('0x27')](handleError(_0x21ce97,null));},exports['destroy']=function(_0x35345f,_0x28128c){const _0x27b75c=_0x184f96;return db['FreshdeskAccount'][_0x27b75c('0x31')]({'where':{'id':_0x35345f['params']['id']}})[_0x27b75c('0x43')](handleEntityNotFound(_0x28128c,null))[_0x27b75c('0x43')](removeEntity(_0x28128c,null))[_0x27b75c('0x27')](handleError(_0x28128c,null));},exports[_0x184f96('0x49')]=function(_0x3fe10c,_0x1b07df){const _0x2580eb=_0x184f96;let _0x3afbe4={};const _0xdc287={};let _0xa9d64f,_0x135706;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x3fe10c[_0x2580eb('0x3f')]['id']}})[_0x2580eb('0x43')](handleEntityNotFound(_0x1b07df,null))[_0x2580eb('0x43')](function(_0x1362ff){const _0x4a49bd=_0x2580eb;if(_0x1362ff)return _0xa9d64f=_0x1362ff,_0xdc287[_0x4a49bd('0x46')]=_['keys'](db[_0x4a49bd('0xb')]['rawAttributes']),_0xdc287[_0x4a49bd('0x57')]=_[_0x4a49bd('0xd')](_0x3fe10c['query']),_0xdc287[_0x4a49bd('0x39')]=_[_0x4a49bd('0x36')](_0xdc287[_0x4a49bd('0x46')],_0xdc287[_0x4a49bd('0x57')]),_0x3afbe4[_0x4a49bd('0x48')]=_[_0x4a49bd('0x36')](_0xdc287[_0x4a49bd('0x46')],qs[_0x4a49bd('0x3')](_0x3fe10c[_0x4a49bd('0x57')][_0x4a49bd('0x3')])),_0x3afbe4[_0x4a49bd('0x48')]=_0x3afbe4[_0x4a49bd('0x48')][_0x4a49bd('0x4c')]?_0x3afbe4['attributes']:_0xdc287[_0x4a49bd('0x46')],_0x3afbe4[_0x4a49bd('0x4')]=qs['sort'](_0x3fe10c[_0x4a49bd('0x57')][_0x4a49bd('0x9')]),_0x3afbe4[_0x4a49bd('0x58')]=qs[_0x4a49bd('0x39')](_['pick'](_0x3fe10c['query'],_0xdc287[_0x4a49bd('0x39')])),_0x3fe10c[_0x4a49bd('0x57')][_0x4a49bd('0x40')]&&(_0x3afbe4['where']=_[_0x4a49bd('0x59')](_0x3afbe4[_0x4a49bd('0x58')],{[Op['or']]:_[_0x4a49bd('0x2c')](_0x3afbe4[_0x4a49bd('0x48')],function(_0xb9a4f7){const _0x5b1d8e=_0x4a49bd,_0x11dcf9={};return _0x11dcf9[_0xb9a4f7]={[Op[_0x5b1d8e('0x10')]]:'%'+_0x3fe10c[_0x5b1d8e('0x57')][_0x5b1d8e('0x40')]+'%'},_0x11dcf9;})})),_0x3afbe4=_[_0x4a49bd('0x59')]({},_0x3afbe4,_0x3fe10c[_0x4a49bd('0x1f')]),_0xa9d64f['getConfigurations'](_0x3afbe4);})['then'](function(_0x5ad001){const _0x2f703a=_0x2580eb;if(_0x5ad001)return _0x135706=_0x5ad001[_0x2f703a('0x4c')],typeof _0x3fe10c['query'][_0x2f703a('0x44')]===_0x2f703a('0x28')&&(_0x3afbe4[_0x2f703a('0x35')]=qs[_0x2f703a('0x35')](_0x3fe10c['query']['limit']),_0x3afbe4[_0x2f703a('0x50')]=qs[_0x2f703a('0x50')](_0x3fe10c[_0x2f703a('0x57')][_0x2f703a('0x50')])),_0xa9d64f[_0x2f703a('0x49')](_0x3afbe4);})[_0x2580eb('0x43')](function(_0xed4c09){if(_0xed4c09)return _0xed4c09?{'count':_0x135706,'rows':_0xed4c09}:null;})['then'](respondWithResult(_0x1b07df,null))[_0x2580eb('0x27')](handleError(_0x1b07df,null));},exports[_0x184f96('0x33')]=function(_0x523bab,_0x1cee08){const _0x565b62=_0x184f96;return _0x523bab[_0x565b62('0x37')]['id']&&delete _0x523bab['body']['id'],db['FreshdeskAccount'][_0x565b62('0x31')]({'where':{'id':_0x523bab[_0x565b62('0x3f')]['id']}})[_0x565b62('0x43')](handleEntityNotFound(_0x1cee08,null))[_0x565b62('0x43')](function(_0x583573){const _0x167d14=_0x565b62;if(_0x583573)return _0x523bab[_0x167d14('0x37')][_0x167d14('0x41')]=_0x583573['id'],_0x523bab[_0x167d14('0x37')][_0x167d14('0x1c')]=integrations[_0x167d14('0x11')](_0x523bab[_0x167d14('0x37')]['channel'],_0x523bab[_0x167d14('0x37')]['type']),_0x523bab[_0x167d14('0x37')][_0x167d14('0x7')]=integrations['getDescriptions'](_0x523bab[_0x167d14('0x37')][_0x167d14('0x23')],_0x523bab[_0x167d14('0x37')][_0x167d14('0x4d')]),db[_0x167d14('0xb')]['create'](_0x523bab[_0x167d14('0x37')],{'include':[{'model':db[_0x167d14('0x1a')],'as':_0x167d14('0x1c')},{'model':db[_0x167d14('0x1a')],'as':_0x167d14('0x7')}]});return null;})['then'](respondWithResult(_0x1cee08,null))[_0x565b62('0x27')](handleError(_0x1cee08,null));},exports[_0x184f96('0x4b')]=function(_0xac85e0,_0x5d2b0c){const _0x211ef5=_0x184f96;let _0x4fc621='';return db['FreshdeskAccount'][_0x211ef5('0x31')]({'where':{'id':_0xac85e0[_0x211ef5('0x3f')]['id']},'attributes':['id',_0x211ef5('0x47'),_0x211ef5('0x5b')]})['then'](handleEntityNotFound(_0x5d2b0c,null))[_0x211ef5('0x43')](function(_0x4e473e){const _0x598ef9=_0x211ef5;if(_0x4e473e){_0x4fc621=_0x4e473e[_0x598ef9('0x47')];const _0x3ee53d=_0x4fc621[_0x598ef9('0x4e')](-0x1);return _0x3ee53d==='/'&&(_0x4fc621=_0x4fc621['substring'](0x0,_0x4fc621['lastIndexOf'](_0x3ee53d))),rp({'method':_0x598ef9('0x56'),'uri':util[_0x598ef9('0x2b')](_0x598ef9('0x4a'),_0x4fc621,_0x598ef9('0x54')),'headers':{'Authorization':util[_0x598ef9('0x2b')]('Basic\x20%s',Buffer[_0x598ef9('0x1')](util[_0x598ef9('0x2b')]('%s:X',_0x4e473e[_0x598ef9('0x5b')]))[_0x598ef9('0x53')](_0x598ef9('0xf')))},'json':!![]});}})[_0x211ef5('0x43')](function(_0x451b3d){const _0x3cdefb=_0x211ef5;if(_0x451b3d){const _0x4a3186=[_0x3cdefb('0x25'),_0x3cdefb('0x3a'),'agent',_0x3cdefb('0x20'),_0x3cdefb('0x1b'),_0x3cdefb('0x5'),_0x3cdefb('0x30'),_0x3cdefb('0x1d'),_0x3cdefb('0x0'),_0x3cdefb('0x30'),'company'];return _[_0x3cdefb('0x45')](_0x451b3d,function(_0x529d07){const _0xea234b=_0x3cdefb;return _0x4a3186[_0xea234b('0x15')](_0x529d07['name'])||!_0x529d07['default']&&_0x529d07[_0xea234b('0x4d')]!==_0xea234b('0x26')&&_0x529d07[_0xea234b('0x4d')]!==_0xea234b('0x42');}),{'count':_0x451b3d[_0x3cdefb('0x4c')],'rows':_[_0x3cdefb('0x2c')](_0x451b3d,function(_0x26c7bd){const _0x733987=_0x3cdefb;return{'id':_0x26c7bd[_0x733987('0x34')],'name':_0x26c7bd[_0x733987('0x3e')],'custom':!_0x26c7bd['default'],'options':_0x26c7bd[_0x733987('0x16')]?_['map'](_0x26c7bd['choices'],function(_0x1660f8){return{'name':_['capitalize'](_0x1660f8),'value':_0x1660f8};}):[]};})};}})[_0x211ef5('0x43')](respondWithResult(_0x5d2b0c,null))[_0x211ef5('0x27')](function(_0x3d4f38){const _0x512db5=_0x211ef5;let _0x12e42f=_0xac85e0[_0x512db5('0x57')][_0x512db5('0x3c')]?0x1f4:_0x3d4f38[_0x512db5('0x2a')]||0x1f4;logger[_0x512db5('0x12')](_0x512db5('0xa'),'getFields',_0x12e42f,JSON[_0x512db5('0x38')](_0x3d4f38)),delete _0x3d4f38['name'],_0x12e42f===0x191&&(_0x12e42f=0x190),_0x5d2b0c[_0x512db5('0x1b')](_0x12e42f)[_0x512db5('0x51')](_0xac85e0[_0x512db5('0x57')][_0x512db5('0x3c')]?{'message':_0x512db5('0x1e'),'statusCode':_0x3d4f38['statusCode']}:_0x3d4f38);});};
\ No newline at end of file