Built motion from commit 709aa6fb5ed03aa61bc373fcdbf622215d37d30b. Version 3.0.0...
[motion-next.git] / server / api / intDeskAccount / intDeskAccount.controller.js
index db78013..4aac944 100644 (file)
@@ -1 +1 @@
-const a229_0x4979=['model','pick','tokenSecret','body','intersection','util','test','application/json','getConfigurations','DeskConfiguration','options','includeAll','length','basic','toString','format','like','count','headers','update','Subjects','map','getDescriptions','type','keys','_embedded','request-promise-native','set','findAll','stack','lodash','username','error','statusCode','fieldName','filter','params','Descriptions','%s:%s','sequelize','authType','entries','sort','sendStatus','index','destroy','key','../../mysqldb','Authorization','send','lastIndexOf','nolimit','active','base64','query','limit','findOne','show','getFields','Content-Range','substring','order','priority','consumerKey','password','Wrong\x20credentials','create','include','status','getSubjects','merge','attributes','remoteUri','catch','filters','AccountId','end','GET','DeskAccount','rawAttributes','../../components/integrations/configuration','slice','where','name','channel','then','offset','VIRTUAL','fields','from','rows','json','label','getFields,\x20%s,\x20%s,\x20%s','DeskField','token'];(function(_0xac5c37,_0x49795b){const _0x3eac75=function(_0x3deee7){while(--_0x3deee7){_0xac5c37['push'](_0xac5c37['shift']());}};_0x3eac75(++_0x49795b);}(a229_0x4979,0x98));const a229_0x3eac=function(_0xac5c37,_0x49795b){_0xac5c37=_0xac5c37-0x0;let _0x3eac75=a229_0x4979[_0xac5c37];return _0x3eac75;};const _0x3d797c=a229_0x3eac;'use strict';const rp=require(_0x3d797c('0x42')),util=require(_0x3d797c('0x2d')),_=require(_0x3d797c('0x46')),qs=require('../../components/parsers/qs'),logger=require('../../config/logger')('api'),db=require(_0x3d797c('0x57'))['db'],{Op}=require(_0x3d797c('0x4f')),integrations=require(_0x3d797c('0x18'));function respondWithResult(_0x3deee7,_0x5dc6d8){return _0x5dc6d8=_0x5dc6d8||0xc8,function(_0x1fcfbb){const _0x50632b=a229_0x3eac;if(_0x1fcfbb)return _0x3deee7[_0x50632b('0xc')](_0x5dc6d8)[_0x50632b('0x23')](_0x1fcfbb);};}function respondWithFilteredResult(_0xc7d6f5,_0x4bac6a){return function(_0x3bba7a){const _0x3e4e7f=a229_0x3eac;if(_0x3bba7a){const _0x32ddc6=_0x3bba7a['count'],_0x4028e5=_0x4bac6a['offset'];let _0x4baed5=_0x4bac6a[_0x3e4e7f('0x1e')]+_0x4bac6a[_0x3e4e7f('0x5f')],_0x5789df;return _0x4baed5>=_0x32ddc6?(_0x4baed5=_0x32ddc6,_0x5789df=0xc8):_0x5789df=0xce,_0xc7d6f5[_0x3e4e7f('0xc')](_0x5789df),_0xc7d6f5[_0x3e4e7f('0x43')](_0x3e4e7f('0x3'),_0x4028e5+'-'+_0x4baed5+'/'+_0x32ddc6)['json'](_0x3bba7a);}return null;};}function saveUpdates(_0x2a8cef){return function(_0x3e7fc5){if(_0x3e7fc5)return _0x3e7fc5['update'](_0x2a8cef)['then'](function(_0x186075){return _0x186075;});return null;};}function removeEntity(_0x183c0c){return function(_0x3b47bb){const _0x474198=a229_0x3eac;if(_0x3b47bb)return _0x3b47bb[_0x474198('0x55')]()[_0x474198('0x1d')](function(){const _0x296f56=_0x474198;_0x183c0c['status'](0xcc)[_0x296f56('0x14')]();});};}function handleEntityNotFound(_0x4457cd){return function(_0x3a39e9){const _0x1dc4ce=a229_0x3eac;return!_0x3a39e9&&_0x4457cd[_0x1dc4ce('0x53')](0x194),_0x3a39e9;};}function handleError(_0x13a5cc,_0x17e97a){return _0x17e97a=_0x17e97a||0x1f4,function(_0x66b1a3){const _0x94c7ae=a229_0x3eac;logger['error'](_0x66b1a3[_0x94c7ae('0x45')]),_0x66b1a3[_0x94c7ae('0x1b')]&&delete _0x66b1a3[_0x94c7ae('0x1b')],_0x13a5cc[_0x94c7ae('0xc')](_0x17e97a)[_0x94c7ae('0x59')](_0x66b1a3);};}exports[_0x3d797c('0x54')]=function(_0x26c955,_0x325e70){const _0x38492f=_0x3d797c;let _0x472af4={};const _0x1a08ca={},_0x12dcc4={'count':0x0,'rows':[]},_0x3fe204=_['map'](db[_0x38492f('0x16')][_0x38492f('0x17')],function(_0x178797){const _0x3e8f61=_0x38492f;return{'name':_0x178797[_0x3e8f61('0x4a')],'type':_0x178797[_0x3e8f61('0x3f')][_0x3e8f61('0x56')]};});_0x1a08ca['model']=_[_0x38492f('0x3d')](_0x3fe204,_0x38492f('0x1b')),_0x1a08ca['query']=_[_0x38492f('0x40')](_0x26c955['query']),_0x1a08ca[_0x38492f('0x12')]=_[_0x38492f('0x2c')](_0x1a08ca['model'],_0x1a08ca[_0x38492f('0x5e')]),_0x472af4['attributes']=_[_0x38492f('0x2c')](_0x1a08ca['model'],qs['fields'](_0x26c955[_0x38492f('0x5e')]['fields'])),_0x472af4['attributes']=_0x472af4['attributes'][_0x38492f('0x34')]?_0x472af4[_0x38492f('0xf')]:_0x1a08ca[_0x38492f('0x28')];typeof _0x26c955[_0x38492f('0x5e')][_0x38492f('0x5b')]==='undefined'&&(_0x472af4[_0x38492f('0x5f')]=qs[_0x38492f('0x5f')](_0x26c955[_0x38492f('0x5e')][_0x38492f('0x5f')]),_0x472af4[_0x38492f('0x1e')]=qs['offset'](_0x26c955[_0x38492f('0x5e')][_0x38492f('0x1e')]));_0x472af4['order']=qs[_0x38492f('0x52')](_0x26c955[_0x38492f('0x5e')]['sort']),_0x472af4['where']=qs[_0x38492f('0x12')](_[_0x38492f('0x29')](_0x26c955['query'],_0x1a08ca['filters']),_0x3fe204);_0x26c955[_0x38492f('0x5e')][_0x38492f('0x4b')]&&(_0x472af4[_0x38492f('0x1a')]=_[_0x38492f('0xe')](_0x472af4[_0x38492f('0x1a')],{[Op['or']]:_[_0x38492f('0x3d')](_0x3fe204,function(_0x292be0){const _0x2a889a=_0x38492f;if(_0x292be0[_0x2a889a('0x3f')]!==_0x2a889a('0x1f')){const _0x19b054={};return _0x19b054[_0x292be0[_0x2a889a('0x1b')]]={[Op[_0x2a889a('0x38')]]:'%'+_0x26c955[_0x2a889a('0x5e')][_0x2a889a('0x4b')]+'%'},_0x19b054;}})}));_0x472af4=_[_0x38492f('0xe')]({},_0x472af4,_0x26c955[_0x38492f('0x32')]);const _0x351858={'where':_0x472af4['where']};return db[_0x38492f('0x16')][_0x38492f('0x39')](_0x351858)['then'](function(_0x4638d7){const _0x597202=_0x38492f;return _0x12dcc4['count']=_0x4638d7,_0x26c955[_0x597202('0x5e')]['includeAll']&&(_0x472af4['include']=[{'all':!![]}]),db[_0x597202('0x16')][_0x597202('0x44')](_0x472af4);})['then'](function(_0x3f6d01){const _0x2d8767=_0x38492f;return _0x12dcc4[_0x2d8767('0x22')]=_0x3f6d01,_0x12dcc4;})[_0x38492f('0x1d')](respondWithFilteredResult(_0x325e70,_0x472af4))[_0x38492f('0x11')](handleError(_0x325e70,null));},exports[_0x3d797c('0x1')]=function(_0x2c5930,_0x345b75){const _0x5f3179=_0x3d797c;let _0x35081d={'raw':![],'where':{'id':_0x2c5930[_0x5f3179('0x4c')]['id']}};const _0x39d995={};return _0x39d995[_0x5f3179('0x28')]=_[_0x5f3179('0x40')](db[_0x5f3179('0x16')]['rawAttributes']),_0x39d995[_0x5f3179('0x5e')]=_[_0x5f3179('0x40')](_0x2c5930['query']),_0x39d995[_0x5f3179('0x12')]=_[_0x5f3179('0x2c')](_0x39d995[_0x5f3179('0x28')],_0x39d995['query']),_0x35081d[_0x5f3179('0xf')]=_[_0x5f3179('0x2c')](_0x39d995[_0x5f3179('0x28')],qs[_0x5f3179('0x20')](_0x2c5930[_0x5f3179('0x5e')][_0x5f3179('0x20')])),_0x35081d[_0x5f3179('0xf')]=_0x35081d['attributes']['length']?_0x35081d[_0x5f3179('0xf')]:_0x39d995[_0x5f3179('0x28')],_0x2c5930[_0x5f3179('0x5e')][_0x5f3179('0x33')]&&(_0x35081d[_0x5f3179('0xb')]=[{'all':!![]}]),_0x35081d=_[_0x5f3179('0xe')]({},_0x35081d,_0x2c5930['options']),db[_0x5f3179('0x16')][_0x5f3179('0x0')](_0x35081d)[_0x5f3179('0x1d')](handleEntityNotFound(_0x345b75,null))[_0x5f3179('0x1d')](respondWithResult(_0x345b75,null))[_0x5f3179('0x11')](handleError(_0x345b75,null));},exports[_0x3d797c('0xa')]=function(_0x51be9c,_0x14012f){const _0x123799=_0x3d797c;return db[_0x123799('0x16')]['create'](_0x51be9c[_0x123799('0x2b')],{})[_0x123799('0x1d')](respondWithResult(_0x14012f,0xc9))[_0x123799('0x11')](handleError(_0x14012f,null));},exports[_0x3d797c('0x3b')]=function(_0x31cb4f,_0x333361){const _0x2e7f0d=_0x3d797c;return _0x31cb4f[_0x2e7f0d('0x2b')]['id']&&delete _0x31cb4f[_0x2e7f0d('0x2b')]['id'],db[_0x2e7f0d('0x16')]['findOne']({'where':{'id':_0x31cb4f['params']['id']}})['then'](handleEntityNotFound(_0x333361,null))['then'](saveUpdates(_0x31cb4f[_0x2e7f0d('0x2b')],null))[_0x2e7f0d('0x1d')](respondWithResult(_0x333361,null))[_0x2e7f0d('0x11')](handleError(_0x333361,null));},exports[_0x3d797c('0x55')]=function(_0xad2a2f,_0x400363){const _0x5780a5=_0x3d797c;return db[_0x5780a5('0x16')][_0x5780a5('0x0')]({'where':{'id':_0xad2a2f[_0x5780a5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x400363,null))[_0x5780a5('0x1d')](removeEntity(_0x400363,null))['catch'](handleError(_0x400363,null));},exports[_0x3d797c('0x30')]=function(_0x1108b1,_0x5f390f){const _0x18ecb4=_0x3d797c;let _0x3f6dc6={};const _0x530e9b={};let _0x2a8672,_0x1ee9e3;return db[_0x18ecb4('0x16')][_0x18ecb4('0x0')]({'where':{'id':_0x1108b1[_0x18ecb4('0x4c')]['id']}})[_0x18ecb4('0x1d')](handleEntityNotFound(_0x5f390f,null))[_0x18ecb4('0x1d')](function(_0x5b1ae7){const _0x403b88=_0x18ecb4;if(_0x5b1ae7)return _0x2a8672=_0x5b1ae7,_0x530e9b[_0x403b88('0x28')]=_[_0x403b88('0x40')](db[_0x403b88('0x31')][_0x403b88('0x17')]),_0x530e9b[_0x403b88('0x5e')]=_['keys'](_0x1108b1['query']),_0x530e9b[_0x403b88('0x12')]=_['intersection'](_0x530e9b['model'],_0x530e9b[_0x403b88('0x5e')]),_0x3f6dc6['attributes']=_['intersection'](_0x530e9b[_0x403b88('0x28')],qs[_0x403b88('0x20')](_0x1108b1[_0x403b88('0x5e')]['fields'])),_0x3f6dc6[_0x403b88('0xf')]=_0x3f6dc6[_0x403b88('0xf')][_0x403b88('0x34')]?_0x3f6dc6['attributes']:_0x530e9b[_0x403b88('0x28')],_0x3f6dc6[_0x403b88('0x5')]=qs['sort'](_0x1108b1[_0x403b88('0x5e')][_0x403b88('0x52')]),_0x3f6dc6[_0x403b88('0x1a')]=qs[_0x403b88('0x12')](_[_0x403b88('0x29')](_0x1108b1[_0x403b88('0x5e')],_0x530e9b[_0x403b88('0x12')])),_0x1108b1[_0x403b88('0x5e')]['filter']&&(_0x3f6dc6[_0x403b88('0x1a')]=_[_0x403b88('0xe')](_0x3f6dc6[_0x403b88('0x1a')],{[Op['or']]:_[_0x403b88('0x3d')](_0x3f6dc6['attributes'],function(_0x3337e8){const _0x39efb1=_0x403b88,_0x5b2e90={};return _0x5b2e90[_0x3337e8]={[Op[_0x39efb1('0x38')]]:'%'+_0x1108b1[_0x39efb1('0x5e')]['filter']+'%'},_0x5b2e90;})})),_0x3f6dc6=_[_0x403b88('0xe')]({},_0x3f6dc6,_0x1108b1['options']),_0x2a8672[_0x403b88('0x30')](_0x3f6dc6);})['then'](function(_0x2bf41c){const _0x226ef2=_0x18ecb4;if(_0x2bf41c)return _0x1ee9e3=_0x2bf41c[_0x226ef2('0x34')],typeof _0x1108b1[_0x226ef2('0x5e')][_0x226ef2('0x5b')]==='undefined'&&(_0x3f6dc6[_0x226ef2('0x5f')]=qs[_0x226ef2('0x5f')](_0x1108b1[_0x226ef2('0x5e')][_0x226ef2('0x5f')]),_0x3f6dc6[_0x226ef2('0x1e')]=qs[_0x226ef2('0x1e')](_0x1108b1[_0x226ef2('0x5e')][_0x226ef2('0x1e')])),_0x2a8672['getConfigurations'](_0x3f6dc6);})[_0x18ecb4('0x1d')](function(_0x277647){if(_0x277647)return _0x277647?{'count':_0x1ee9e3,'rows':_0x277647}:null;})[_0x18ecb4('0x1d')](respondWithResult(_0x5f390f,null))[_0x18ecb4('0x11')](handleError(_0x5f390f,null));},exports['addConfiguration']=function(_0xd7752c,_0x10e836){const _0x4c2fc7=_0x3d797c;return _0xd7752c[_0x4c2fc7('0x2b')]['id']&&delete _0xd7752c[_0x4c2fc7('0x2b')]['id'],db[_0x4c2fc7('0x16')]['findOne']({'where':{'id':_0xd7752c[_0x4c2fc7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x10e836,null))[_0x4c2fc7('0x1d')](function(_0x4cae1b){const _0x2c7fb1=_0x4c2fc7;if(_0x4cae1b)return _0xd7752c['body'][_0x2c7fb1('0x13')]=_0x4cae1b['id'],_0xd7752c['body'][_0x2c7fb1('0x3c')]=integrations[_0x2c7fb1('0xd')](_0xd7752c['body'][_0x2c7fb1('0x1c')],_0xd7752c[_0x2c7fb1('0x2b')][_0x2c7fb1('0x3f')]),_0xd7752c[_0x2c7fb1('0x2b')][_0x2c7fb1('0x4d')]=integrations[_0x2c7fb1('0x3e')](_0xd7752c[_0x2c7fb1('0x2b')]['channel'],_0xd7752c['body'][_0x2c7fb1('0x3f')]),db[_0x2c7fb1('0x31')][_0x2c7fb1('0xa')](_0xd7752c[_0x2c7fb1('0x2b')],{'include':[{'model':db[_0x2c7fb1('0x26')],'as':_0x2c7fb1('0x3c')},{'model':db[_0x2c7fb1('0x26')],'as':'Descriptions'}]});return null;})[_0x4c2fc7('0x1d')](respondWithResult(_0x10e836,null))['catch'](handleError(_0x10e836,null));},exports[_0x3d797c('0x2')]=function(_0x3dff0d,_0x414a4e){const _0x597e92=_0x3d797c,_0x38a074=[{'name':_0x597e92('0x6'),'label':_0x597e92('0x6'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];let _0xca36f4='';return db[_0x597e92('0x16')]['findOne']({'where':{'id':_0x3dff0d['params']['id']},'attributes':['id',_0x597e92('0x10'),_0x597e92('0x50'),_0x597e92('0x47'),_0x597e92('0x8'),_0x597e92('0x7'),'consumerSecret',_0x597e92('0x27'),_0x597e92('0x2a')]})['then'](handleEntityNotFound(_0x414a4e,null))['then'](function(_0x30d685){const _0x1fbcb8=_0x597e92;if(_0x30d685){_0xca36f4=_0x30d685[_0x1fbcb8('0x10')];const _0x4cf4cd=_0xca36f4[_0x1fbcb8('0x19')](-0x1);_0x4cf4cd==='/'&&(_0xca36f4=_0xca36f4[_0x1fbcb8('0x4')](0x0,_0xca36f4[_0x1fbcb8('0x5a')](_0x4cf4cd)));const _0x316833={'method':_0x1fbcb8('0x15'),'uri':util['format']('%s/custom_fields',_0xca36f4),'headers':{'Content-Type':_0x1fbcb8('0x2f'),'Accept':_0x1fbcb8('0x2f')},'json':!![]};return _0x30d685['authType']===_0x1fbcb8('0x35')&&(_0x316833[_0x1fbcb8('0x3a')][_0x1fbcb8('0x58')]=util[_0x1fbcb8('0x37')]('Basic\x20%s',Buffer[_0x1fbcb8('0x21')](util[_0x1fbcb8('0x37')](_0x1fbcb8('0x4e'),_0x30d685[_0x1fbcb8('0x47')],_0x30d685['password']))[_0x1fbcb8('0x36')](_0x1fbcb8('0x5d')))),rp(_0x316833)['then'](function(_0x2476be){const _0x283ed5=_0x1fbcb8;return _0x38a074['concat'](_[_0x283ed5('0x3d')](_0x2476be[_0x283ed5('0x41')][_0x283ed5('0x51')],function(_0x1ee687){const _0xe58091=_0x283ed5;return{'id':_0x1ee687[_0xe58091('0x1b')],'name':_0x1ee687[_0xe58091('0x1b')],'type':_0x1ee687[_0xe58091('0x3f')],'active':_0x1ee687[_0xe58091('0x5c')],'label':_0x1ee687[_0xe58091('0x24')],'custom':!![]};}));});}})[_0x597e92('0x1d')](function(_0x132b23){return{'count':_0x132b23['length'],'rows':_0x132b23};})[_0x597e92('0x1d')](respondWithResult(_0x414a4e,null))[_0x597e92('0x11')](function(_0x4e93bf){const _0x149551=_0x597e92;let _0x31802a=_0x3dff0d[_0x149551('0x5e')][_0x149551('0x2e')]?0x1f4:_0x4e93bf[_0x149551('0x49')]||0x1f4;logger[_0x149551('0x48')](_0x149551('0x25'),_0x149551('0x2'),_0x31802a,JSON['stringify'](_0x4e93bf)),delete _0x4e93bf[_0x149551('0x1b')],_0x31802a===0x191&&(_0x31802a=0x190),_0x414a4e[_0x149551('0xc')](_0x31802a)[_0x149551('0x59')](_0x3dff0d['query'][_0x149551('0x2e')]?{'message':_0x149551('0x9'),'statusCode':_0x4e93bf[_0x149551('0x49')]}:_0x4e93bf);});};
\ No newline at end of file
+const a229_0x4815=['lastIndexOf','toString','key','DeskField','fields','test','util','lodash','length','findOne','query','Subjects','../../mysqldb','end','consumerKey','AccountId','includeAll','options','GET','slice','catch','%s:%s','nolimit','request-promise-native','show','../../components/parsers/qs','application/json','like','type','getFields,\x20%s,\x20%s,\x20%s','create','../../components/integrations/configuration','sendStatus','offset','../../config/logger','then','rawAttributes','DeskAccount','pick','send','undefined','where','%s/custom_fields','remoteUri','index','intersection','sort','entries','destroy','channel','password','set','attributes','Wrong\x20credentials','getConfigurations','api','tokenSecret','filter','map','sequelize','statusCode','stringify','substring','Authorization','headers','merge','getFields','rows','authType','count','token','from','getSubjects','DeskConfiguration','error','filters','VIRTUAL','json','Descriptions','include','getDescriptions','name','order','Content-Range','model','format','priority','keys','limit','status','active','params','body','username'];(function(_0x2bb272,_0x481564){const _0x20714d=function(_0x4138f1){while(--_0x4138f1){_0x2bb272['push'](_0x2bb272['shift']());}};_0x20714d(++_0x481564);}(a229_0x4815,0x1e7));const a229_0x2071=function(_0x2bb272,_0x481564){_0x2bb272=_0x2bb272-0x0;let _0x20714d=a229_0x4815[_0x2bb272];return _0x20714d;};const _0x131994=a229_0x2071;'use strict';const rp=require(_0x131994('0x6')),util=require(_0x131994('0x53')),_=require(_0x131994('0x54')),qs=require(_0x131994('0x8')),logger=require(_0x131994('0x11'))(_0x131994('0x26')),db=require(_0x131994('0x59'))['db'],{Op}=require(_0x131994('0x2a')),integrations=require(_0x131994('0xe'));function respondWithResult(_0x4138f1,_0x4cb526){return _0x4cb526=_0x4cb526||0xc8,function(_0x4c9030){const _0x21bbc7=a229_0x2071;if(_0x4c9030)return _0x4138f1[_0x21bbc7('0x48')](_0x4cb526)[_0x21bbc7('0x3c')](_0x4c9030);};}function respondWithFilteredResult(_0x58e07e,_0x2aacb9){return function(_0x38f2ab){const _0x52e9c5=a229_0x2071;if(_0x38f2ab){const _0xc6641c=_0x38f2ab['count'],_0x443206=_0x2aacb9[_0x52e9c5('0x10')];let _0x320e3b=_0x2aacb9[_0x52e9c5('0x10')]+_0x2aacb9[_0x52e9c5('0x47')],_0x5142bd;return _0x320e3b>=_0xc6641c?(_0x320e3b=_0xc6641c,_0x5142bd=0xc8):_0x5142bd=0xce,_0x58e07e[_0x52e9c5('0x48')](_0x5142bd),_0x58e07e[_0x52e9c5('0x22')](_0x52e9c5('0x42'),_0x443206+'-'+_0x320e3b+'/'+_0xc6641c)[_0x52e9c5('0x3c')](_0x38f2ab);}return null;};}function saveUpdates(_0x1bcbc5){return function(_0x141115){const _0x4ba059=a229_0x2071;if(_0x141115)return _0x141115['update'](_0x1bcbc5)[_0x4ba059('0x12')](function(_0x75a168){return _0x75a168;});return null;};}function removeEntity(_0x3f6b85){return function(_0x21e321){const _0x51e56d=a229_0x2071;if(_0x21e321)return _0x21e321[_0x51e56d('0x1f')]()['then'](function(){const _0x7fefbd=_0x51e56d;_0x3f6b85[_0x7fefbd('0x48')](0xcc)[_0x7fefbd('0x5a')]();});};}function handleEntityNotFound(_0x494625){return function(_0x443b5c){const _0x36ab0a=a229_0x2071;return!_0x443b5c&&_0x494625[_0x36ab0a('0xf')](0x194),_0x443b5c;};}function handleError(_0x33d098,_0x3b2b7a){return _0x3b2b7a=_0x3b2b7a||0x1f4,function(_0x2beab0){const _0x484cb9=a229_0x2071;logger[_0x484cb9('0x39')](_0x2beab0['stack']),_0x2beab0[_0x484cb9('0x40')]&&delete _0x2beab0[_0x484cb9('0x40')],_0x33d098[_0x484cb9('0x48')](_0x3b2b7a)['send'](_0x2beab0);};}exports[_0x131994('0x1b')]=function(_0x15d76b,_0xbbf731){const _0x2fcf5a=_0x131994;let _0x352ac1={};const _0x1f6df4={},_0x1b756d={'count':0x0,'rows':[]},_0x46ec8c=_['map'](db[_0x2fcf5a('0x14')][_0x2fcf5a('0x13')],function(_0x46094d){const _0x1cb4b7=_0x2fcf5a;return{'name':_0x46094d['fieldName'],'type':_0x46094d[_0x1cb4b7('0xb')][_0x1cb4b7('0x4f')]};});_0x1f6df4['model']=_['map'](_0x46ec8c,'name'),_0x1f6df4[_0x2fcf5a('0x57')]=_[_0x2fcf5a('0x46')](_0x15d76b[_0x2fcf5a('0x57')]),_0x1f6df4['filters']=_['intersection'](_0x1f6df4[_0x2fcf5a('0x43')],_0x1f6df4['query']),_0x352ac1[_0x2fcf5a('0x23')]=_[_0x2fcf5a('0x1c')](_0x1f6df4[_0x2fcf5a('0x43')],qs[_0x2fcf5a('0x51')](_0x15d76b[_0x2fcf5a('0x57')][_0x2fcf5a('0x51')])),_0x352ac1[_0x2fcf5a('0x23')]=_0x352ac1['attributes'][_0x2fcf5a('0x55')]?_0x352ac1[_0x2fcf5a('0x23')]:_0x1f6df4[_0x2fcf5a('0x43')];typeof _0x15d76b['query']['nolimit']===_0x2fcf5a('0x17')&&(_0x352ac1[_0x2fcf5a('0x47')]=qs[_0x2fcf5a('0x47')](_0x15d76b[_0x2fcf5a('0x57')][_0x2fcf5a('0x47')]),_0x352ac1[_0x2fcf5a('0x10')]=qs['offset'](_0x15d76b[_0x2fcf5a('0x57')][_0x2fcf5a('0x10')]));_0x352ac1[_0x2fcf5a('0x41')]=qs[_0x2fcf5a('0x1d')](_0x15d76b[_0x2fcf5a('0x57')][_0x2fcf5a('0x1d')]),_0x352ac1[_0x2fcf5a('0x18')]=qs[_0x2fcf5a('0x3a')](_['pick'](_0x15d76b[_0x2fcf5a('0x57')],_0x1f6df4[_0x2fcf5a('0x3a')]),_0x46ec8c);_0x15d76b[_0x2fcf5a('0x57')][_0x2fcf5a('0x28')]&&(_0x352ac1[_0x2fcf5a('0x18')]=_[_0x2fcf5a('0x30')](_0x352ac1[_0x2fcf5a('0x18')],{[Op['or']]:_[_0x2fcf5a('0x29')](_0x46ec8c,function(_0x94a099){const _0x5290ea=_0x2fcf5a;if(_0x94a099[_0x5290ea('0xb')]!==_0x5290ea('0x3b')){const _0x204336={};return _0x204336[_0x94a099[_0x5290ea('0x40')]]={[Op[_0x5290ea('0xa')]]:'%'+_0x15d76b[_0x5290ea('0x57')][_0x5290ea('0x28')]+'%'},_0x204336;}})}));_0x352ac1=_['merge']({},_0x352ac1,_0x15d76b['options']);const _0x21bff4={'where':_0x352ac1[_0x2fcf5a('0x18')]};return db[_0x2fcf5a('0x14')][_0x2fcf5a('0x34')](_0x21bff4)[_0x2fcf5a('0x12')](function(_0x579375){const _0x45609f=_0x2fcf5a;return _0x1b756d['count']=_0x579375,_0x15d76b['query'][_0x45609f('0x5d')]&&(_0x352ac1[_0x45609f('0x3e')]=[{'all':!![]}]),db[_0x45609f('0x14')]['findAll'](_0x352ac1);})[_0x2fcf5a('0x12')](function(_0x1d3cad){const _0x3e711e=_0x2fcf5a;return _0x1b756d[_0x3e711e('0x32')]=_0x1d3cad,_0x1b756d;})['then'](respondWithFilteredResult(_0xbbf731,_0x352ac1))[_0x2fcf5a('0x3')](handleError(_0xbbf731,null));},exports[_0x131994('0x7')]=function(_0x4311dd,_0x469bc2){const _0x2f2944=_0x131994;let _0x178483={'raw':![],'where':{'id':_0x4311dd[_0x2f2944('0x4a')]['id']}};const _0x4ab0c0={};return _0x4ab0c0[_0x2f2944('0x43')]=_['keys'](db[_0x2f2944('0x14')][_0x2f2944('0x13')]),_0x4ab0c0[_0x2f2944('0x57')]=_[_0x2f2944('0x46')](_0x4311dd[_0x2f2944('0x57')]),_0x4ab0c0[_0x2f2944('0x3a')]=_['intersection'](_0x4ab0c0['model'],_0x4ab0c0[_0x2f2944('0x57')]),_0x178483['attributes']=_[_0x2f2944('0x1c')](_0x4ab0c0['model'],qs[_0x2f2944('0x51')](_0x4311dd[_0x2f2944('0x57')][_0x2f2944('0x51')])),_0x178483[_0x2f2944('0x23')]=_0x178483[_0x2f2944('0x23')]['length']?_0x178483[_0x2f2944('0x23')]:_0x4ab0c0['model'],_0x4311dd['query']['includeAll']&&(_0x178483[_0x2f2944('0x3e')]=[{'all':!![]}]),_0x178483=_['merge']({},_0x178483,_0x4311dd[_0x2f2944('0x0')]),db[_0x2f2944('0x14')][_0x2f2944('0x56')](_0x178483)[_0x2f2944('0x12')](handleEntityNotFound(_0x469bc2,null))[_0x2f2944('0x12')](respondWithResult(_0x469bc2,null))['catch'](handleError(_0x469bc2,null));},exports[_0x131994('0xd')]=function(_0x40b1e2,_0x1d24e6){const _0x2a4135=_0x131994;return db[_0x2a4135('0x14')][_0x2a4135('0xd')](_0x40b1e2[_0x2a4135('0x4b')],{})[_0x2a4135('0x12')](respondWithResult(_0x1d24e6,0xc9))['catch'](handleError(_0x1d24e6,null));},exports['update']=function(_0x481ae4,_0x106410){const _0x282334=_0x131994;return _0x481ae4[_0x282334('0x4b')]['id']&&delete _0x481ae4[_0x282334('0x4b')]['id'],db[_0x282334('0x14')][_0x282334('0x56')]({'where':{'id':_0x481ae4[_0x282334('0x4a')]['id']}})['then'](handleEntityNotFound(_0x106410,null))['then'](saveUpdates(_0x481ae4[_0x282334('0x4b')],null))['then'](respondWithResult(_0x106410,null))[_0x282334('0x3')](handleError(_0x106410,null));},exports['destroy']=function(_0x3dce55,_0x5b1acd){const _0x1d34d4=_0x131994;return db[_0x1d34d4('0x14')][_0x1d34d4('0x56')]({'where':{'id':_0x3dce55['params']['id']}})[_0x1d34d4('0x12')](handleEntityNotFound(_0x5b1acd,null))[_0x1d34d4('0x12')](removeEntity(_0x5b1acd,null))[_0x1d34d4('0x3')](handleError(_0x5b1acd,null));},exports[_0x131994('0x25')]=function(_0x3e35b7,_0x30d5b){const _0x18a6c0=_0x131994;let _0x4be42f={};const _0x339986={};let _0x228b1c,_0x222544;return db['DeskAccount'][_0x18a6c0('0x56')]({'where':{'id':_0x3e35b7[_0x18a6c0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x30d5b,null))[_0x18a6c0('0x12')](function(_0x241f5a){const _0x2956f9=_0x18a6c0;if(_0x241f5a)return _0x228b1c=_0x241f5a,_0x339986[_0x2956f9('0x43')]=_[_0x2956f9('0x46')](db[_0x2956f9('0x38')][_0x2956f9('0x13')]),_0x339986[_0x2956f9('0x57')]=_['keys'](_0x3e35b7['query']),_0x339986[_0x2956f9('0x3a')]=_[_0x2956f9('0x1c')](_0x339986[_0x2956f9('0x43')],_0x339986[_0x2956f9('0x57')]),_0x4be42f[_0x2956f9('0x23')]=_[_0x2956f9('0x1c')](_0x339986['model'],qs[_0x2956f9('0x51')](_0x3e35b7['query'][_0x2956f9('0x51')])),_0x4be42f['attributes']=_0x4be42f[_0x2956f9('0x23')][_0x2956f9('0x55')]?_0x4be42f[_0x2956f9('0x23')]:_0x339986[_0x2956f9('0x43')],_0x4be42f['order']=qs['sort'](_0x3e35b7[_0x2956f9('0x57')][_0x2956f9('0x1d')]),_0x4be42f[_0x2956f9('0x18')]=qs['filters'](_[_0x2956f9('0x15')](_0x3e35b7['query'],_0x339986[_0x2956f9('0x3a')])),_0x3e35b7['query'][_0x2956f9('0x28')]&&(_0x4be42f[_0x2956f9('0x18')]=_['merge'](_0x4be42f[_0x2956f9('0x18')],{[Op['or']]:_[_0x2956f9('0x29')](_0x4be42f[_0x2956f9('0x23')],function(_0x1e521a){const _0x486798=_0x2956f9,_0x3cabce={};return _0x3cabce[_0x1e521a]={[Op[_0x486798('0xa')]]:'%'+_0x3e35b7[_0x486798('0x57')][_0x486798('0x28')]+'%'},_0x3cabce;})})),_0x4be42f=_[_0x2956f9('0x30')]({},_0x4be42f,_0x3e35b7['options']),_0x228b1c[_0x2956f9('0x25')](_0x4be42f);})[_0x18a6c0('0x12')](function(_0x471315){const _0x3016fc=_0x18a6c0;if(_0x471315)return _0x222544=_0x471315[_0x3016fc('0x55')],typeof _0x3e35b7[_0x3016fc('0x57')][_0x3016fc('0x5')]===_0x3016fc('0x17')&&(_0x4be42f[_0x3016fc('0x47')]=qs['limit'](_0x3e35b7['query'][_0x3016fc('0x47')]),_0x4be42f['offset']=qs[_0x3016fc('0x10')](_0x3e35b7['query'][_0x3016fc('0x10')])),_0x228b1c[_0x3016fc('0x25')](_0x4be42f);})['then'](function(_0x1fc7f9){if(_0x1fc7f9)return _0x1fc7f9?{'count':_0x222544,'rows':_0x1fc7f9}:null;})[_0x18a6c0('0x12')](respondWithResult(_0x30d5b,null))[_0x18a6c0('0x3')](handleError(_0x30d5b,null));},exports['addConfiguration']=function(_0x50a920,_0x287ce6){const _0x101612=_0x131994;return _0x50a920[_0x101612('0x4b')]['id']&&delete _0x50a920[_0x101612('0x4b')]['id'],db['DeskAccount'][_0x101612('0x56')]({'where':{'id':_0x50a920['params']['id']}})[_0x101612('0x12')](handleEntityNotFound(_0x287ce6,null))[_0x101612('0x12')](function(_0x3299b8){const _0x585e70=_0x101612;if(_0x3299b8)return _0x50a920[_0x585e70('0x4b')][_0x585e70('0x5c')]=_0x3299b8['id'],_0x50a920[_0x585e70('0x4b')][_0x585e70('0x58')]=integrations[_0x585e70('0x37')](_0x50a920['body'][_0x585e70('0x20')],_0x50a920['body'][_0x585e70('0xb')]),_0x50a920[_0x585e70('0x4b')][_0x585e70('0x3d')]=integrations[_0x585e70('0x3f')](_0x50a920['body'][_0x585e70('0x20')],_0x50a920[_0x585e70('0x4b')]['type']),db[_0x585e70('0x38')][_0x585e70('0xd')](_0x50a920[_0x585e70('0x4b')],{'include':[{'model':db[_0x585e70('0x50')],'as':_0x585e70('0x58')},{'model':db[_0x585e70('0x50')],'as':_0x585e70('0x3d')}]});return null;})[_0x101612('0x12')](respondWithResult(_0x287ce6,null))[_0x101612('0x3')](handleError(_0x287ce6,null));},exports['getFields']=function(_0x1b33bc,_0x15dd73){const _0x149747=_0x131994,_0x3860ff=[{'name':_0x149747('0x45'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];let _0x22632b='';return db[_0x149747('0x14')][_0x149747('0x56')]({'where':{'id':_0x1b33bc[_0x149747('0x4a')]['id']},'attributes':['id','remoteUri',_0x149747('0x33'),_0x149747('0x4c'),_0x149747('0x21'),_0x149747('0x5b'),'consumerSecret',_0x149747('0x35'),_0x149747('0x27')]})[_0x149747('0x12')](handleEntityNotFound(_0x15dd73,null))[_0x149747('0x12')](function(_0x32e727){const _0x4eaaa6=_0x149747;if(_0x32e727){_0x22632b=_0x32e727[_0x4eaaa6('0x1a')];const _0x2d855b=_0x22632b[_0x4eaaa6('0x2')](-0x1);_0x2d855b==='/'&&(_0x22632b=_0x22632b[_0x4eaaa6('0x2d')](0x0,_0x22632b[_0x4eaaa6('0x4d')](_0x2d855b)));const _0x596e35={'method':_0x4eaaa6('0x1'),'uri':util[_0x4eaaa6('0x44')](_0x4eaaa6('0x19'),_0x22632b),'headers':{'Content-Type':_0x4eaaa6('0x9'),'Accept':_0x4eaaa6('0x9')},'json':!![]};return _0x32e727[_0x4eaaa6('0x33')]==='basic'&&(_0x596e35[_0x4eaaa6('0x2f')][_0x4eaaa6('0x2e')]=util[_0x4eaaa6('0x44')]('Basic\x20%s',Buffer[_0x4eaaa6('0x36')](util[_0x4eaaa6('0x44')](_0x4eaaa6('0x4'),_0x32e727[_0x4eaaa6('0x4c')],_0x32e727[_0x4eaaa6('0x21')]))[_0x4eaaa6('0x4e')]('base64'))),rp(_0x596e35)[_0x4eaaa6('0x12')](function(_0xdfb9e6){const _0x1eab0c=_0x4eaaa6;return _0x3860ff['concat'](_[_0x1eab0c('0x29')](_0xdfb9e6['_embedded'][_0x1eab0c('0x1e')],function(_0x197cd3){const _0x4d23b6=_0x1eab0c;return{'id':_0x197cd3['name'],'name':_0x197cd3['name'],'type':_0x197cd3['type'],'active':_0x197cd3[_0x4d23b6('0x49')],'label':_0x197cd3['label'],'custom':!![]};}));});}})['then'](function(_0x29e047){const _0x766833=_0x149747;return{'count':_0x29e047[_0x766833('0x55')],'rows':_0x29e047};})['then'](respondWithResult(_0x15dd73,null))[_0x149747('0x3')](function(_0x256fe9){const _0x3c68e6=_0x149747;let _0x4649ef=_0x1b33bc['query'][_0x3c68e6('0x52')]?0x1f4:_0x256fe9[_0x3c68e6('0x2b')]||0x1f4;logger[_0x3c68e6('0x39')](_0x3c68e6('0xc'),_0x3c68e6('0x31'),_0x4649ef,JSON[_0x3c68e6('0x2c')](_0x256fe9)),delete _0x256fe9[_0x3c68e6('0x40')],_0x4649ef===0x191&&(_0x4649ef=0x190),_0x15dd73[_0x3c68e6('0x48')](_0x4649ef)[_0x3c68e6('0x16')](_0x1b33bc[_0x3c68e6('0x57')][_0x3c68e6('0x52')]?{'message':_0x3c68e6('0x24'),'statusCode':_0x256fe9[_0x3c68e6('0x2b')]}:_0x256fe9);});};
\ No newline at end of file