Built motion from commit bfc7a72f7045b27461c9a5d1f71c1a658cfd0b8b. Version 3.0.0...
[motion-next.git] / server / api / intFreshdeskAccount / intFreshdeskAccount.controller.js
index ebcc21a..3979f2a 100644 (file)
@@ -1 +1 @@
-const a255_0xbe23=['default','update','show','getConfigurations','format','create','merge','params','include','capitalize','GET','key','requester','util','priority','where','offset','ticket_type','getSubjects','fieldName','api','sequelize','query','order','statusCode','attributes','fields','end','custom_text','choices','getDescriptions','model','VIRTUAL','then','Subjects','FreshdeskField','request-promise-native','findOne','stack','send','Wrong\x20credentials','body','lodash','api/v2/ticket_fields','getFields,\x20%s,\x20%s,\x20%s','remove','index','json','nolimit','Content-Range','count','custom_dropdown','../../mysqldb','addConfiguration','rows','agent','FreshdeskConfiguration','../../components/integrations/configuration','filter','length','%s/%s','undefined','FreshdeskAccount','stringify','set','intersection','catch','channel','label','destroy','keys','%s:X','map','sendStatus','test','description','pick','type','status','../../config/logger','remoteUri','sort','options','limit','slice','rawAttributes','../../components/parsers/qs','lastIndexOf','includeAll','group','from','apiKey','name','filters'];(function(_0x30140f,_0xbe235d){const _0x5e2021=function(_0x1be4ee){while(--_0x1be4ee){_0x30140f['push'](_0x30140f['shift']());}};_0x5e2021(++_0xbe235d);}(a255_0xbe23,0x11f));const a255_0x5e20=function(_0x30140f,_0xbe235d){_0x30140f=_0x30140f-0x0;let _0x5e2021=a255_0xbe23[_0x30140f];return _0x5e2021;};const _0x34fbed=a255_0x5e20;'use strict';const rp=require(_0x34fbed('0x1f')),util=require(_0x34fbed('0x8')),_=require(_0x34fbed('0x25')),qs=require(_0x34fbed('0x51')),logger=require(_0x34fbed('0x4a'))(_0x34fbed('0xf')),db=require(_0x34fbed('0x2f'))['db'],{Op}=require(_0x34fbed('0x10')),integrations=require(_0x34fbed('0x34'));function respondWithResult(_0x1be4ee,_0x22e03c){return _0x22e03c=_0x22e03c||0xc8,function(_0x34c31f){const _0x228015=a255_0x5e20;if(_0x34c31f)return _0x1be4ee[_0x228015('0x49')](_0x22e03c)[_0x228015('0x2a')](_0x34c31f);};}function respondWithFilteredResult(_0x10b5ae,_0x1bb2da){return function(_0x4e9ffc){const _0x224a58=a255_0x5e20;if(_0x4e9ffc){const _0x1ffc73=_0x4e9ffc['count'],_0x463993=_0x1bb2da[_0x224a58('0xb')];let _0x38e7dd=_0x1bb2da[_0x224a58('0xb')]+_0x1bb2da[_0x224a58('0x4e')],_0x5156c9;return _0x38e7dd>=_0x1ffc73?(_0x38e7dd=_0x1ffc73,_0x5156c9=0xc8):_0x5156c9=0xce,_0x10b5ae[_0x224a58('0x49')](_0x5156c9),_0x10b5ae[_0x224a58('0x3b')](_0x224a58('0x2c'),_0x463993+'-'+_0x38e7dd+'/'+_0x1ffc73)[_0x224a58('0x2a')](_0x4e9ffc);}return null;};}function saveUpdates(_0x46dead){return function(_0x40e04f){const _0x25a61b=a255_0x5e20;if(_0x40e04f)return _0x40e04f[_0x25a61b('0x5a')](_0x46dead)[_0x25a61b('0x1c')](function(_0x489ca5){return _0x489ca5;});return null;};}function removeEntity(_0x44bcd8){return function(_0x3e9d32){const _0xd1f9ca=a255_0x5e20;if(_0x3e9d32)return _0x3e9d32[_0xd1f9ca('0x40')]()['then'](function(){const _0xe78449=_0xd1f9ca;_0x44bcd8[_0xe78449('0x49')](0xcc)[_0xe78449('0x16')]();});};}function handleEntityNotFound(_0x3579f2){return function(_0x4e93a7){const _0x5ec355=a255_0x5e20;return!_0x4e93a7&&_0x3579f2[_0x5ec355('0x44')](0x194),_0x4e93a7;};}function handleError(_0x33bc99,_0x1fc309){return _0x1fc309=_0x1fc309||0x1f4,function(_0x1961bf){const _0x951c3=a255_0x5e20;logger['error'](_0x1961bf[_0x951c3('0x21')]),_0x1961bf['name']&&delete _0x1961bf[_0x951c3('0x57')],_0x33bc99['status'](_0x1fc309)['send'](_0x1961bf);};}exports[_0x34fbed('0x29')]=function(_0x5d4fe4,_0xa58152){const _0x554c58=_0x34fbed;let _0xffabf1={};const _0x195912={},_0x553b34={'count':0x0,'rows':[]},_0x18266f=_[_0x554c58('0x43')](db[_0x554c58('0x39')][_0x554c58('0x50')],function(_0x3b663f){const _0x55e04a=_0x554c58;return{'name':_0x3b663f[_0x55e04a('0xe')],'type':_0x3b663f['type'][_0x55e04a('0x6')]};});_0x195912[_0x554c58('0x1a')]=_[_0x554c58('0x43')](_0x18266f,_0x554c58('0x57')),_0x195912['query']=_[_0x554c58('0x41')](_0x5d4fe4[_0x554c58('0x11')]),_0x195912[_0x554c58('0x58')]=_['intersection'](_0x195912[_0x554c58('0x1a')],_0x195912['query']),_0xffabf1[_0x554c58('0x14')]=_[_0x554c58('0x3c')](_0x195912[_0x554c58('0x1a')],qs[_0x554c58('0x15')](_0x5d4fe4[_0x554c58('0x11')][_0x554c58('0x15')])),_0xffabf1[_0x554c58('0x14')]=_0xffabf1[_0x554c58('0x14')]['length']?_0xffabf1[_0x554c58('0x14')]:_0x195912[_0x554c58('0x1a')];typeof _0x5d4fe4[_0x554c58('0x11')][_0x554c58('0x2b')]===_0x554c58('0x38')&&(_0xffabf1['limit']=qs[_0x554c58('0x4e')](_0x5d4fe4[_0x554c58('0x11')]['limit']),_0xffabf1[_0x554c58('0xb')]=qs[_0x554c58('0xb')](_0x5d4fe4[_0x554c58('0x11')][_0x554c58('0xb')]));_0xffabf1[_0x554c58('0x12')]=qs[_0x554c58('0x4c')](_0x5d4fe4[_0x554c58('0x11')][_0x554c58('0x4c')]),_0xffabf1[_0x554c58('0xa')]=qs[_0x554c58('0x58')](_[_0x554c58('0x47')](_0x5d4fe4['query'],_0x195912['filters']),_0x18266f);_0x5d4fe4[_0x554c58('0x11')][_0x554c58('0x35')]&&(_0xffabf1[_0x554c58('0xa')]=_[_0x554c58('0x1')](_0xffabf1[_0x554c58('0xa')],{[Op['or']]:_[_0x554c58('0x43')](_0x18266f,function(_0x56db45){const _0x59aa6e=_0x554c58;if(_0x56db45['type']!==_0x59aa6e('0x1b')){const _0x404e0f={};return _0x404e0f[_0x56db45['name']]={[Op['like']]:'%'+_0x5d4fe4['query'][_0x59aa6e('0x35')]+'%'},_0x404e0f;}})}));_0xffabf1=_[_0x554c58('0x1')]({},_0xffabf1,_0x5d4fe4[_0x554c58('0x4d')]);const _0x5a0806={'where':_0xffabf1[_0x554c58('0xa')]};return db[_0x554c58('0x39')]['count'](_0x5a0806)[_0x554c58('0x1c')](function(_0x3069d3){const _0xd5cec3=_0x554c58;return _0x553b34[_0xd5cec3('0x2d')]=_0x3069d3,_0x5d4fe4[_0xd5cec3('0x11')][_0xd5cec3('0x53')]&&(_0xffabf1[_0xd5cec3('0x3')]=[{'all':!![]}]),db[_0xd5cec3('0x39')]['findAll'](_0xffabf1);})['then'](function(_0x4c0ca1){const _0x5ba876=_0x554c58;return _0x553b34[_0x5ba876('0x31')]=_0x4c0ca1,_0x553b34;})[_0x554c58('0x1c')](respondWithFilteredResult(_0xa58152,_0xffabf1))[_0x554c58('0x3d')](handleError(_0xa58152,null));},exports[_0x34fbed('0x5b')]=function(_0x3d4187,_0x19d09a){const _0x129c85=_0x34fbed;let _0x27130c={'raw':![],'where':{'id':_0x3d4187['params']['id']}};const _0x5d2b3f={};return _0x5d2b3f[_0x129c85('0x1a')]=_['keys'](db[_0x129c85('0x39')][_0x129c85('0x50')]),_0x5d2b3f['query']=_['keys'](_0x3d4187[_0x129c85('0x11')]),_0x5d2b3f['filters']=_[_0x129c85('0x3c')](_0x5d2b3f[_0x129c85('0x1a')],_0x5d2b3f[_0x129c85('0x11')]),_0x27130c['attributes']=_[_0x129c85('0x3c')](_0x5d2b3f[_0x129c85('0x1a')],qs[_0x129c85('0x15')](_0x3d4187[_0x129c85('0x11')][_0x129c85('0x15')])),_0x27130c[_0x129c85('0x14')]=_0x27130c[_0x129c85('0x14')][_0x129c85('0x36')]?_0x27130c['attributes']:_0x5d2b3f[_0x129c85('0x1a')],_0x3d4187[_0x129c85('0x11')][_0x129c85('0x53')]&&(_0x27130c[_0x129c85('0x3')]=[{'all':!![]}]),_0x27130c=_[_0x129c85('0x1')]({},_0x27130c,_0x3d4187['options']),db[_0x129c85('0x39')][_0x129c85('0x20')](_0x27130c)[_0x129c85('0x1c')](handleEntityNotFound(_0x19d09a,null))[_0x129c85('0x1c')](respondWithResult(_0x19d09a,null))['catch'](handleError(_0x19d09a,null));},exports['create']=function(_0x23949b,_0x867723){const _0x565605=_0x34fbed;return db[_0x565605('0x39')]['create'](_0x23949b[_0x565605('0x24')],{})[_0x565605('0x1c')](respondWithResult(_0x867723,0xc9))[_0x565605('0x3d')](handleError(_0x867723,null));},exports[_0x34fbed('0x5a')]=function(_0x4c5a9a,_0x3227cb){const _0x1b5418=_0x34fbed;return _0x4c5a9a[_0x1b5418('0x24')]['id']&&delete _0x4c5a9a[_0x1b5418('0x24')]['id'],db[_0x1b5418('0x39')][_0x1b5418('0x20')]({'where':{'id':_0x4c5a9a['params']['id']}})[_0x1b5418('0x1c')](handleEntityNotFound(_0x3227cb,null))[_0x1b5418('0x1c')](saveUpdates(_0x4c5a9a[_0x1b5418('0x24')],null))[_0x1b5418('0x1c')](respondWithResult(_0x3227cb,null))['catch'](handleError(_0x3227cb,null));},exports['destroy']=function(_0xa8359c,_0x2fa446){const _0x1fcc8f=_0x34fbed;return db[_0x1fcc8f('0x39')][_0x1fcc8f('0x20')]({'where':{'id':_0xa8359c[_0x1fcc8f('0x2')]['id']}})['then'](handleEntityNotFound(_0x2fa446,null))[_0x1fcc8f('0x1c')](removeEntity(_0x2fa446,null))[_0x1fcc8f('0x3d')](handleError(_0x2fa446,null));},exports[_0x34fbed('0x5c')]=function(_0x23ded9,_0x56dbae){const _0x4a03a5=_0x34fbed;let _0x2f9379={};const _0x411449={};let _0x52a945,_0x106367;return db[_0x4a03a5('0x39')][_0x4a03a5('0x20')]({'where':{'id':_0x23ded9[_0x4a03a5('0x2')]['id']}})[_0x4a03a5('0x1c')](handleEntityNotFound(_0x56dbae,null))[_0x4a03a5('0x1c')](function(_0x2cb461){const _0x5ca640=_0x4a03a5;if(_0x2cb461)return _0x52a945=_0x2cb461,_0x411449['model']=_[_0x5ca640('0x41')](db[_0x5ca640('0x33')][_0x5ca640('0x50')]),_0x411449[_0x5ca640('0x11')]=_['keys'](_0x23ded9[_0x5ca640('0x11')]),_0x411449[_0x5ca640('0x58')]=_[_0x5ca640('0x3c')](_0x411449[_0x5ca640('0x1a')],_0x411449[_0x5ca640('0x11')]),_0x2f9379[_0x5ca640('0x14')]=_[_0x5ca640('0x3c')](_0x411449[_0x5ca640('0x1a')],qs[_0x5ca640('0x15')](_0x23ded9[_0x5ca640('0x11')]['fields'])),_0x2f9379[_0x5ca640('0x14')]=_0x2f9379[_0x5ca640('0x14')][_0x5ca640('0x36')]?_0x2f9379[_0x5ca640('0x14')]:_0x411449[_0x5ca640('0x1a')],_0x2f9379[_0x5ca640('0x12')]=qs['sort'](_0x23ded9[_0x5ca640('0x11')]['sort']),_0x2f9379[_0x5ca640('0xa')]=qs['filters'](_[_0x5ca640('0x47')](_0x23ded9[_0x5ca640('0x11')],_0x411449[_0x5ca640('0x58')])),_0x23ded9[_0x5ca640('0x11')]['filter']&&(_0x2f9379[_0x5ca640('0xa')]=_[_0x5ca640('0x1')](_0x2f9379[_0x5ca640('0xa')],{[Op['or']]:_[_0x5ca640('0x43')](_0x2f9379[_0x5ca640('0x14')],function(_0x5dab20){const _0x18bb84=_0x5ca640,_0x8c991={};return _0x8c991[_0x5dab20]={[Op['like']]:'%'+_0x23ded9['query'][_0x18bb84('0x35')]+'%'},_0x8c991;})})),_0x2f9379=_['merge']({},_0x2f9379,_0x23ded9[_0x5ca640('0x4d')]),_0x52a945[_0x5ca640('0x5c')](_0x2f9379);})[_0x4a03a5('0x1c')](function(_0xbec4da){const _0x42e584=_0x4a03a5;if(_0xbec4da)return _0x106367=_0xbec4da[_0x42e584('0x36')],typeof _0x23ded9[_0x42e584('0x11')]['nolimit']===_0x42e584('0x38')&&(_0x2f9379[_0x42e584('0x4e')]=qs['limit'](_0x23ded9[_0x42e584('0x11')][_0x42e584('0x4e')]),_0x2f9379['offset']=qs[_0x42e584('0xb')](_0x23ded9[_0x42e584('0x11')][_0x42e584('0xb')])),_0x52a945[_0x42e584('0x5c')](_0x2f9379);})[_0x4a03a5('0x1c')](function(_0x3dde7a){if(_0x3dde7a)return _0x3dde7a?{'count':_0x106367,'rows':_0x3dde7a}:null;})[_0x4a03a5('0x1c')](respondWithResult(_0x56dbae,null))[_0x4a03a5('0x3d')](handleError(_0x56dbae,null));},exports[_0x34fbed('0x30')]=function(_0x1622f8,_0x282a8e){const _0x1fe337=_0x34fbed;return _0x1622f8[_0x1fe337('0x24')]['id']&&delete _0x1622f8[_0x1fe337('0x24')]['id'],db[_0x1fe337('0x39')]['findOne']({'where':{'id':_0x1622f8[_0x1fe337('0x2')]['id']}})[_0x1fe337('0x1c')](handleEntityNotFound(_0x282a8e,null))[_0x1fe337('0x1c')](function(_0x200d81){const _0x9d0fae=_0x1fe337;if(_0x200d81)return _0x1622f8[_0x9d0fae('0x24')]['AccountId']=_0x200d81['id'],_0x1622f8[_0x9d0fae('0x24')][_0x9d0fae('0x1d')]=integrations[_0x9d0fae('0xd')](_0x1622f8[_0x9d0fae('0x24')]['channel'],_0x1622f8[_0x9d0fae('0x24')][_0x9d0fae('0x48')]),_0x1622f8[_0x9d0fae('0x24')]['Descriptions']=integrations[_0x9d0fae('0x19')](_0x1622f8['body'][_0x9d0fae('0x3e')],_0x1622f8[_0x9d0fae('0x24')][_0x9d0fae('0x48')]),db[_0x9d0fae('0x33')][_0x9d0fae('0x0')](_0x1622f8[_0x9d0fae('0x24')],{'include':[{'model':db[_0x9d0fae('0x1e')],'as':_0x9d0fae('0x1d')},{'model':db[_0x9d0fae('0x1e')],'as':'Descriptions'}]});return null;})[_0x1fe337('0x1c')](respondWithResult(_0x282a8e,null))[_0x1fe337('0x3d')](handleError(_0x282a8e,null));},exports['getFields']=function(_0x2af377,_0x57b1a0){const _0x32ccd2=_0x34fbed;let _0x4b25e0='';return db[_0x32ccd2('0x39')][_0x32ccd2('0x20')]({'where':{'id':_0x2af377[_0x32ccd2('0x2')]['id']},'attributes':['id','remoteUri','apiKey']})[_0x32ccd2('0x1c')](handleEntityNotFound(_0x57b1a0,null))[_0x32ccd2('0x1c')](function(_0x3c1a61){const _0x38dad9=_0x32ccd2;if(_0x3c1a61){_0x4b25e0=_0x3c1a61[_0x38dad9('0x4b')];const _0x59730c=_0x4b25e0[_0x38dad9('0x4f')](-0x1);return _0x59730c==='/'&&(_0x4b25e0=_0x4b25e0['substring'](0x0,_0x4b25e0[_0x38dad9('0x52')](_0x59730c))),rp({'method':_0x38dad9('0x5'),'uri':util['format'](_0x38dad9('0x37'),_0x4b25e0,_0x38dad9('0x26')),'headers':{'Authorization':util[_0x38dad9('0x5d')]('Basic\x20%s',Buffer[_0x38dad9('0x55')](util['format'](_0x38dad9('0x42'),_0x3c1a61[_0x38dad9('0x56')]))['toString']('base64'))},'json':!![]});}})[_0x32ccd2('0x1c')](function(_0x38f2b8){const _0x2c22f1=_0x32ccd2;if(_0x38f2b8){const _0x1a5fb5=[_0x2c22f1('0x7'),'subject',_0x2c22f1('0x32'),_0x2c22f1('0x46'),_0x2c22f1('0x49'),_0x2c22f1('0x9'),'group','source',_0x2c22f1('0xc'),_0x2c22f1('0x54'),'company'];return _[_0x2c22f1('0x28')](_0x38f2b8,function(_0x5c9934){const _0x45d3e2=_0x2c22f1;return _0x1a5fb5['includes'](_0x5c9934[_0x45d3e2('0x57')])||!_0x5c9934[_0x45d3e2('0x59')]&&_0x5c9934[_0x45d3e2('0x48')]!==_0x45d3e2('0x17')&&_0x5c9934[_0x45d3e2('0x48')]!==_0x45d3e2('0x2e');}),{'count':_0x38f2b8[_0x2c22f1('0x36')],'rows':_[_0x2c22f1('0x43')](_0x38f2b8,function(_0x15c4f6){const _0x255a94=_0x2c22f1;return{'id':_0x15c4f6[_0x255a94('0x57')],'name':_0x15c4f6[_0x255a94('0x3f')],'custom':!_0x15c4f6[_0x255a94('0x59')],'options':_0x15c4f6[_0x255a94('0x18')]?_[_0x255a94('0x43')](_0x15c4f6[_0x255a94('0x18')],function(_0x1369e8){const _0x7c3391=_0x255a94;return{'name':_[_0x7c3391('0x4')](_0x1369e8),'value':_0x1369e8};}):[]};})};}})[_0x32ccd2('0x1c')](respondWithResult(_0x57b1a0,null))[_0x32ccd2('0x3d')](function(_0x4461df){const _0x104c25=_0x32ccd2;let _0x1c12f3=_0x2af377[_0x104c25('0x11')][_0x104c25('0x45')]?0x1f4:_0x4461df[_0x104c25('0x13')]||0x1f4;logger['error'](_0x104c25('0x27'),'getFields',_0x1c12f3,JSON[_0x104c25('0x3a')](_0x4461df)),delete _0x4461df[_0x104c25('0x57')],_0x1c12f3===0x191&&(_0x1c12f3=0x190),_0x57b1a0[_0x104c25('0x49')](_0x1c12f3)[_0x104c25('0x22')](_0x2af377[_0x104c25('0x11')]['test']?{'message':_0x104c25('0x23'),'statusCode':_0x4461df[_0x104c25('0x13')]}:_0x4461df);});};
\ No newline at end of file
+const a255_0x2632=['findAll','query','agent','json','apiKey','%s/%s','remoteUri','request-promise-native','toString','ticket_type','rawAttributes','lodash','test','addConfiguration','stringify','include','../../components/parsers/qs','type','then','requester','remove','update','body','Subjects','filter','keys','offset','filters','capitalize','Basic\x20%s','error','Wrong\x20credentials','show','../../mysqldb','description','rows','AccountId','count','getFields','order','fieldName','catch','model','slice','nolimit','format','fields','like','name','getSubjects','%s:X','limit','where','pick','status','../../components/integrations/configuration','key','Descriptions','index','../../config/logger','findOne','sendStatus','destroy','channel','VIRTUAL','create','includeAll','attributes','FreshdeskConfiguration','group','lastIndexOf','api/v2/ticket_fields','getConfigurations','sort','FreshdeskAccount','params','FreshdeskField','set','intersection','options','Content-Range','map','custom_text','end','default','choices','undefined','statusCode','stack','length','merge','substring'];(function(_0x1976ba,_0x26321f){const _0x8c0002=function(_0x4bb3b8){while(--_0x4bb3b8){_0x1976ba['push'](_0x1976ba['shift']());}};_0x8c0002(++_0x26321f);}(a255_0x2632,0x92));const a255_0x8c00=function(_0x1976ba,_0x26321f){_0x1976ba=_0x1976ba-0x0;let _0x8c0002=a255_0x2632[_0x1976ba];return _0x8c0002;};const _0x2206f2=a255_0x8c00;'use strict';const rp=require(_0x2206f2('0x2d')),util=require('util'),_=require(_0x2206f2('0x31')),qs=require(_0x2206f2('0x36')),logger=require(_0x2206f2('0x5'))('api'),db=require(_0x2206f2('0x47'))['db'],{Op}=require('sequelize'),integrations=require(_0x2206f2('0x1'));function respondWithResult(_0x4bb3b8,_0x4b80d9){return _0x4b80d9=_0x4b80d9||0xc8,function(_0x4f1928){const _0xc031e8=a255_0x8c00;if(_0x4f1928)return _0x4bb3b8['status'](_0x4b80d9)[_0xc031e8('0x29')](_0x4f1928);};}function respondWithFilteredResult(_0x41196c,_0x2cd114){return function(_0x5b6488){const _0x211b70=a255_0x8c00;if(_0x5b6488){const _0x3fde12=_0x5b6488[_0x211b70('0x4b')],_0x77eb3c=_0x2cd114[_0x211b70('0x40')];let _0x157818=_0x2cd114['offset']+_0x2cd114[_0x211b70('0x59')],_0x532177;return _0x157818>=_0x3fde12?(_0x157818=_0x3fde12,_0x532177=0xc8):_0x532177=0xce,_0x41196c[_0x211b70('0x0')](_0x532177),_0x41196c[_0x211b70('0x17')](_0x211b70('0x1a'),_0x77eb3c+'-'+_0x157818+'/'+_0x3fde12)[_0x211b70('0x29')](_0x5b6488);}return null;};}function saveUpdates(_0x3d93ce){return function(_0x16c763){const _0x14cd9a=a255_0x8c00;if(_0x16c763)return _0x16c763[_0x14cd9a('0x3b')](_0x3d93ce)['then'](function(_0x3e2db7){return _0x3e2db7;});return null;};}function removeEntity(_0x5908ea){return function(_0x599a4a){const _0x363ff5=a255_0x8c00;if(_0x599a4a)return _0x599a4a[_0x363ff5('0x8')]()['then'](function(){const _0x337d19=_0x363ff5;_0x5908ea[_0x337d19('0x0')](0xcc)[_0x337d19('0x1d')]();});};}function handleEntityNotFound(_0x31c647){return function(_0x518a3e){const _0x4522d0=a255_0x8c00;return!_0x518a3e&&_0x31c647[_0x4522d0('0x7')](0x194),_0x518a3e;};}function handleError(_0x43c5ca,_0x46b909){return _0x46b909=_0x46b909||0x1f4,function(_0x102a46){const _0x3fd8e9=a255_0x8c00;logger[_0x3fd8e9('0x44')](_0x102a46[_0x3fd8e9('0x22')]),_0x102a46[_0x3fd8e9('0x56')]&&delete _0x102a46['name'],_0x43c5ca[_0x3fd8e9('0x0')](_0x46b909)['send'](_0x102a46);};}exports[_0x2206f2('0x4')]=function(_0x8b9736,_0xf2a27c){const _0xd49600=_0x2206f2;let _0xdf15bf={};const _0x3cfddf={},_0x49f3cf={'count':0x0,'rows':[]},_0x43a7c3=_[_0xd49600('0x1b')](db[_0xd49600('0x14')][_0xd49600('0x30')],function(_0x122e3b){const _0x2fc14d=_0xd49600;return{'name':_0x122e3b[_0x2fc14d('0x4e')],'type':_0x122e3b[_0x2fc14d('0x37')][_0x2fc14d('0x2')]};});_0x3cfddf[_0xd49600('0x50')]=_[_0xd49600('0x1b')](_0x43a7c3,_0xd49600('0x56')),_0x3cfddf[_0xd49600('0x27')]=_['keys'](_0x8b9736[_0xd49600('0x27')]),_0x3cfddf[_0xd49600('0x41')]=_[_0xd49600('0x18')](_0x3cfddf[_0xd49600('0x50')],_0x3cfddf[_0xd49600('0x27')]),_0xdf15bf[_0xd49600('0xd')]=_[_0xd49600('0x18')](_0x3cfddf[_0xd49600('0x50')],qs['fields'](_0x8b9736[_0xd49600('0x27')][_0xd49600('0x54')])),_0xdf15bf[_0xd49600('0xd')]=_0xdf15bf[_0xd49600('0xd')][_0xd49600('0x23')]?_0xdf15bf[_0xd49600('0xd')]:_0x3cfddf[_0xd49600('0x50')];typeof _0x8b9736[_0xd49600('0x27')][_0xd49600('0x52')]===_0xd49600('0x20')&&(_0xdf15bf[_0xd49600('0x59')]=qs['limit'](_0x8b9736[_0xd49600('0x27')][_0xd49600('0x59')]),_0xdf15bf[_0xd49600('0x40')]=qs[_0xd49600('0x40')](_0x8b9736[_0xd49600('0x27')][_0xd49600('0x40')]));_0xdf15bf[_0xd49600('0x4d')]=qs['sort'](_0x8b9736[_0xd49600('0x27')][_0xd49600('0x13')]),_0xdf15bf[_0xd49600('0x5a')]=qs[_0xd49600('0x41')](_[_0xd49600('0x5b')](_0x8b9736[_0xd49600('0x27')],_0x3cfddf[_0xd49600('0x41')]),_0x43a7c3);_0x8b9736[_0xd49600('0x27')]['filter']&&(_0xdf15bf[_0xd49600('0x5a')]=_['merge'](_0xdf15bf[_0xd49600('0x5a')],{[Op['or']]:_[_0xd49600('0x1b')](_0x43a7c3,function(_0x4342be){const _0x1f3db5=_0xd49600;if(_0x4342be[_0x1f3db5('0x37')]!==_0x1f3db5('0xa')){const _0x45c325={};return _0x45c325[_0x4342be[_0x1f3db5('0x56')]]={[Op[_0x1f3db5('0x55')]]:'%'+_0x8b9736[_0x1f3db5('0x27')][_0x1f3db5('0x3e')]+'%'},_0x45c325;}})}));_0xdf15bf=_[_0xd49600('0x24')]({},_0xdf15bf,_0x8b9736[_0xd49600('0x19')]);const _0x24ad76={'where':_0xdf15bf['where']};return db[_0xd49600('0x14')][_0xd49600('0x4b')](_0x24ad76)[_0xd49600('0x38')](function(_0x55ab33){const _0xfae096=_0xd49600;return _0x49f3cf[_0xfae096('0x4b')]=_0x55ab33,_0x8b9736[_0xfae096('0x27')][_0xfae096('0xc')]&&(_0xdf15bf[_0xfae096('0x35')]=[{'all':!![]}]),db[_0xfae096('0x14')][_0xfae096('0x26')](_0xdf15bf);})[_0xd49600('0x38')](function(_0x2ed93c){const _0x1a7cc4=_0xd49600;return _0x49f3cf[_0x1a7cc4('0x49')]=_0x2ed93c,_0x49f3cf;})['then'](respondWithFilteredResult(_0xf2a27c,_0xdf15bf))[_0xd49600('0x4f')](handleError(_0xf2a27c,null));},exports[_0x2206f2('0x46')]=function(_0x35f79f,_0x758db5){const _0xed73c5=_0x2206f2;let _0x33ec3d={'raw':![],'where':{'id':_0x35f79f[_0xed73c5('0x15')]['id']}};const _0x4f22f1={};return _0x4f22f1['model']=_[_0xed73c5('0x3f')](db['FreshdeskAccount'][_0xed73c5('0x30')]),_0x4f22f1['query']=_[_0xed73c5('0x3f')](_0x35f79f[_0xed73c5('0x27')]),_0x4f22f1[_0xed73c5('0x41')]=_['intersection'](_0x4f22f1[_0xed73c5('0x50')],_0x4f22f1[_0xed73c5('0x27')]),_0x33ec3d['attributes']=_[_0xed73c5('0x18')](_0x4f22f1[_0xed73c5('0x50')],qs[_0xed73c5('0x54')](_0x35f79f['query']['fields'])),_0x33ec3d['attributes']=_0x33ec3d['attributes'][_0xed73c5('0x23')]?_0x33ec3d['attributes']:_0x4f22f1['model'],_0x35f79f[_0xed73c5('0x27')]['includeAll']&&(_0x33ec3d[_0xed73c5('0x35')]=[{'all':!![]}]),_0x33ec3d=_[_0xed73c5('0x24')]({},_0x33ec3d,_0x35f79f[_0xed73c5('0x19')]),db[_0xed73c5('0x14')][_0xed73c5('0x6')](_0x33ec3d)['then'](handleEntityNotFound(_0x758db5,null))[_0xed73c5('0x38')](respondWithResult(_0x758db5,null))[_0xed73c5('0x4f')](handleError(_0x758db5,null));},exports[_0x2206f2('0xb')]=function(_0x2062a0,_0x22efef){const _0x14a39f=_0x2206f2;return db[_0x14a39f('0x14')][_0x14a39f('0xb')](_0x2062a0[_0x14a39f('0x3c')],{})['then'](respondWithResult(_0x22efef,0xc9))[_0x14a39f('0x4f')](handleError(_0x22efef,null));},exports[_0x2206f2('0x3b')]=function(_0x22517c,_0x2401c4){const _0x558546=_0x2206f2;return _0x22517c[_0x558546('0x3c')]['id']&&delete _0x22517c['body']['id'],db[_0x558546('0x14')][_0x558546('0x6')]({'where':{'id':_0x22517c[_0x558546('0x15')]['id']}})['then'](handleEntityNotFound(_0x2401c4,null))[_0x558546('0x38')](saveUpdates(_0x22517c['body'],null))[_0x558546('0x38')](respondWithResult(_0x2401c4,null))[_0x558546('0x4f')](handleError(_0x2401c4,null));},exports[_0x2206f2('0x8')]=function(_0xd7723a,_0x35ddd7){const _0x20777d=_0x2206f2;return db[_0x20777d('0x14')][_0x20777d('0x6')]({'where':{'id':_0xd7723a[_0x20777d('0x15')]['id']}})['then'](handleEntityNotFound(_0x35ddd7,null))[_0x20777d('0x38')](removeEntity(_0x35ddd7,null))[_0x20777d('0x4f')](handleError(_0x35ddd7,null));},exports['getConfigurations']=function(_0x2b08d8,_0x1631bf){const _0x3529e3=_0x2206f2;let _0x10a247={};const _0x28e399={};let _0x1953e7,_0x74e44c;return db[_0x3529e3('0x14')][_0x3529e3('0x6')]({'where':{'id':_0x2b08d8[_0x3529e3('0x15')]['id']}})[_0x3529e3('0x38')](handleEntityNotFound(_0x1631bf,null))[_0x3529e3('0x38')](function(_0xc7d4d3){const _0x3438aa=_0x3529e3;if(_0xc7d4d3)return _0x1953e7=_0xc7d4d3,_0x28e399[_0x3438aa('0x50')]=_['keys'](db[_0x3438aa('0xe')][_0x3438aa('0x30')]),_0x28e399['query']=_['keys'](_0x2b08d8[_0x3438aa('0x27')]),_0x28e399['filters']=_[_0x3438aa('0x18')](_0x28e399[_0x3438aa('0x50')],_0x28e399[_0x3438aa('0x27')]),_0x10a247['attributes']=_['intersection'](_0x28e399[_0x3438aa('0x50')],qs[_0x3438aa('0x54')](_0x2b08d8[_0x3438aa('0x27')][_0x3438aa('0x54')])),_0x10a247[_0x3438aa('0xd')]=_0x10a247[_0x3438aa('0xd')][_0x3438aa('0x23')]?_0x10a247[_0x3438aa('0xd')]:_0x28e399[_0x3438aa('0x50')],_0x10a247[_0x3438aa('0x4d')]=qs[_0x3438aa('0x13')](_0x2b08d8['query'][_0x3438aa('0x13')]),_0x10a247['where']=qs[_0x3438aa('0x41')](_[_0x3438aa('0x5b')](_0x2b08d8[_0x3438aa('0x27')],_0x28e399[_0x3438aa('0x41')])),_0x2b08d8[_0x3438aa('0x27')][_0x3438aa('0x3e')]&&(_0x10a247[_0x3438aa('0x5a')]=_[_0x3438aa('0x24')](_0x10a247[_0x3438aa('0x5a')],{[Op['or']]:_['map'](_0x10a247[_0x3438aa('0xd')],function(_0x1c8e1b){const _0x556579=_0x3438aa,_0x5a44c6={};return _0x5a44c6[_0x1c8e1b]={[Op[_0x556579('0x55')]]:'%'+_0x2b08d8[_0x556579('0x27')]['filter']+'%'},_0x5a44c6;})})),_0x10a247=_[_0x3438aa('0x24')]({},_0x10a247,_0x2b08d8['options']),_0x1953e7[_0x3438aa('0x12')](_0x10a247);})['then'](function(_0x773f6){const _0x430342=_0x3529e3;if(_0x773f6)return _0x74e44c=_0x773f6[_0x430342('0x23')],typeof _0x2b08d8[_0x430342('0x27')][_0x430342('0x52')]===_0x430342('0x20')&&(_0x10a247[_0x430342('0x59')]=qs[_0x430342('0x59')](_0x2b08d8[_0x430342('0x27')][_0x430342('0x59')]),_0x10a247[_0x430342('0x40')]=qs[_0x430342('0x40')](_0x2b08d8[_0x430342('0x27')][_0x430342('0x40')])),_0x1953e7[_0x430342('0x12')](_0x10a247);})[_0x3529e3('0x38')](function(_0x3a3769){if(_0x3a3769)return _0x3a3769?{'count':_0x74e44c,'rows':_0x3a3769}:null;})[_0x3529e3('0x38')](respondWithResult(_0x1631bf,null))['catch'](handleError(_0x1631bf,null));},exports[_0x2206f2('0x33')]=function(_0x3eb8bf,_0x1a0f11){const _0x5ed1bc=_0x2206f2;return _0x3eb8bf[_0x5ed1bc('0x3c')]['id']&&delete _0x3eb8bf[_0x5ed1bc('0x3c')]['id'],db[_0x5ed1bc('0x14')]['findOne']({'where':{'id':_0x3eb8bf['params']['id']}})['then'](handleEntityNotFound(_0x1a0f11,null))[_0x5ed1bc('0x38')](function(_0x210b1f){const _0x43bbe=_0x5ed1bc;if(_0x210b1f)return _0x3eb8bf[_0x43bbe('0x3c')][_0x43bbe('0x4a')]=_0x210b1f['id'],_0x3eb8bf[_0x43bbe('0x3c')][_0x43bbe('0x3d')]=integrations[_0x43bbe('0x57')](_0x3eb8bf[_0x43bbe('0x3c')][_0x43bbe('0x9')],_0x3eb8bf[_0x43bbe('0x3c')][_0x43bbe('0x37')]),_0x3eb8bf['body'][_0x43bbe('0x3')]=integrations['getDescriptions'](_0x3eb8bf[_0x43bbe('0x3c')][_0x43bbe('0x9')],_0x3eb8bf['body'][_0x43bbe('0x37')]),db['FreshdeskConfiguration']['create'](_0x3eb8bf[_0x43bbe('0x3c')],{'include':[{'model':db[_0x43bbe('0x16')],'as':_0x43bbe('0x3d')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});return null;})[_0x5ed1bc('0x38')](respondWithResult(_0x1a0f11,null))[_0x5ed1bc('0x4f')](handleError(_0x1a0f11,null));},exports[_0x2206f2('0x4c')]=function(_0x111e6e,_0x193ee9){const _0x40499a=_0x2206f2;let _0x3775be='';return db[_0x40499a('0x14')][_0x40499a('0x6')]({'where':{'id':_0x111e6e[_0x40499a('0x15')]['id']},'attributes':['id',_0x40499a('0x2c'),_0x40499a('0x2a')]})[_0x40499a('0x38')](handleEntityNotFound(_0x193ee9,null))['then'](function(_0x1058c1){const _0x4f71ad=_0x40499a;if(_0x1058c1){_0x3775be=_0x1058c1['remoteUri'];const _0x31b2cc=_0x3775be[_0x4f71ad('0x51')](-0x1);return _0x31b2cc==='/'&&(_0x3775be=_0x3775be[_0x4f71ad('0x25')](0x0,_0x3775be[_0x4f71ad('0x10')](_0x31b2cc))),rp({'method':'GET','uri':util[_0x4f71ad('0x53')](_0x4f71ad('0x2b'),_0x3775be,_0x4f71ad('0x11')),'headers':{'Authorization':util[_0x4f71ad('0x53')](_0x4f71ad('0x43'),Buffer['from'](util[_0x4f71ad('0x53')](_0x4f71ad('0x58'),_0x1058c1[_0x4f71ad('0x2a')]))[_0x4f71ad('0x2e')]('base64'))},'json':!![]});}})[_0x40499a('0x38')](function(_0xb6f4cf){const _0x4b0805=_0x40499a;if(_0xb6f4cf){const _0x181128=[_0x4b0805('0x39'),'subject',_0x4b0805('0x28'),_0x4b0805('0x48'),_0x4b0805('0x0'),'priority','group','source',_0x4b0805('0x2f'),_0x4b0805('0xf'),'company'];return _[_0x4b0805('0x3a')](_0xb6f4cf,function(_0x157a00){const _0x1c4d13=_0x4b0805;return _0x181128['includes'](_0x157a00[_0x1c4d13('0x56')])||!_0x157a00['default']&&_0x157a00[_0x1c4d13('0x37')]!==_0x1c4d13('0x1c')&&_0x157a00[_0x1c4d13('0x37')]!=='custom_dropdown';}),{'count':_0xb6f4cf[_0x4b0805('0x23')],'rows':_[_0x4b0805('0x1b')](_0xb6f4cf,function(_0x298719){const _0xd50ea1=_0x4b0805;return{'id':_0x298719[_0xd50ea1('0x56')],'name':_0x298719['label'],'custom':!_0x298719[_0xd50ea1('0x1e')],'options':_0x298719[_0xd50ea1('0x1f')]?_[_0xd50ea1('0x1b')](_0x298719[_0xd50ea1('0x1f')],function(_0x49884e){const _0xf669aa=_0xd50ea1;return{'name':_[_0xf669aa('0x42')](_0x49884e),'value':_0x49884e};}):[]};})};}})[_0x40499a('0x38')](respondWithResult(_0x193ee9,null))[_0x40499a('0x4f')](function(_0x45e46c){const _0xd1af9c=_0x40499a;let _0x134a1f=_0x111e6e[_0xd1af9c('0x27')][_0xd1af9c('0x32')]?0x1f4:_0x45e46c[_0xd1af9c('0x21')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xd1af9c('0x4c'),_0x134a1f,JSON[_0xd1af9c('0x34')](_0x45e46c)),delete _0x45e46c[_0xd1af9c('0x56')],_0x134a1f===0x191&&(_0x134a1f=0x190),_0x193ee9[_0xd1af9c('0x0')](_0x134a1f)['send'](_0x111e6e['query']['test']?{'message':_0xd1af9c('0x45'),'statusCode':_0x45e46c['statusCode']}:_0x45e46c);});};
\ No newline at end of file