Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / api / intZendeskAccount / intZendeskAccount.controller.js
index 5a8b911..b4eeca6 100644 (file)
@@ -1 +1 @@
-const a400_0x596a=['lastIndexOf','body','%s/token:%s','pick','headers','limit','sequelize','getConfigurations','rawAttributes','%s:%s','../../mysqldb','username','ZendeskConfiguration','ZendeskField','format','set','custom_field_options','order','base64','error','catch','index','fields','../../components/integrations/configuration','Descriptions','stringify','nolimit','where','from','keys','name','lodash','description','filter','offset','fieldName','destroy','json','getFields,\x20%s,\x20%s,\x20%s','then','toString','type','Wrong\x20credentials','getFields','end','undefined','status','ZendeskAccount','subject','create','key','%s/%s','substring','Basic\x20%s','sendStatus','api','group','Subjects','includes','query','update','merge','getSubjects','length','attributes','GET','authType','filters','intersection','VIRTUAL','options','addConfiguration','includeAll','test','ticket_fields','Unknown\x20authentication\x20type','getDescriptions','../../config/logger','send','rows','statusCode','map','system_field_options','include','findOne','params','like','request-promise-native','remoteUri','password','slice','count','token','../../components/parsers/qs','sort','position','title','model'];(function(_0x53f72b,_0x2b5c42){const _0x596a17=function(_0x5384e3){while(--_0x5384e3){_0x53f72b['push'](_0x53f72b['shift']());}};_0x596a17(++_0x2b5c42);}(a400_0x596a,0x128));const a400_0x5384=function(_0x53f72b,_0x2b5c42){_0x53f72b=_0x53f72b-0xc9;let _0x596a17=a400_0x596a[_0x53f72b];return _0x596a17;};const a400_0x238239=a400_0x5384;'use strict';const rp=require(a400_0x238239(0x11e)),util=require('util'),_=require(a400_0x238239(0xe6)),qs=require(a400_0x238239(0x124)),logger=require(a400_0x238239(0x114))(a400_0x238239(0xfe)),{db}=require(a400_0x238239(0xd1)),{Op,ValidationError}=require(a400_0x238239(0xcd)),integrations=require(a400_0x238239(0xde));function respondWithResult(_0x3c5538,_0x17a836){return _0x17a836=_0x17a836||0xc8,function(_0x34a6d7){const _0x26c4ae=a400_0x5384;if(_0x34a6d7)return _0x3c5538[_0x26c4ae(0xf5)](_0x17a836)[_0x26c4ae(0xec)](_0x34a6d7);};}function respondWithFilteredResult(_0x4534a2,_0x49bb89){return function(_0x596e2d){const _0x191be1=a400_0x5384;if(_0x596e2d){const _0x45ca71=_0x596e2d[_0x191be1(0x122)],_0x538521=_0x49bb89[_0x191be1(0xe9)];let _0x4667f2=_0x49bb89[_0x191be1(0xe9)]+_0x49bb89[_0x191be1(0xcc)],_0x8144d6;return _0x4667f2>=_0x45ca71?(_0x4667f2=_0x45ca71,_0x8144d6=0xc8):_0x8144d6=0xce,_0x4534a2['status'](_0x8144d6),_0x4534a2[_0x191be1(0xd6)]('Content-Range',_0x538521+'-'+_0x4667f2+'/'+_0x45ca71)[_0x191be1(0xec)](_0x596e2d);}return null;};}function saveUpdates(_0x33d10f){return function(_0x248ec3){const _0x5032a2=a400_0x5384;if(_0x248ec3)return _0x248ec3[_0x5032a2(0x103)](_0x33d10f)[_0x5032a2(0xee)](function(_0x5a303a){return _0x5a303a;});return null;};}function removeEntity(_0x6b77c3){return function(_0x41d399){const _0x201021=a400_0x5384;if(_0x41d399)return _0x41d399[_0x201021(0xeb)]()[_0x201021(0xee)](function(){const _0x312109=_0x201021;_0x6b77c3['status'](0xcc)[_0x312109(0xf3)]();});};}function handleEntityNotFound(_0x38e41f){return function(_0x2a2a9c){const _0x529da9=a400_0x5384;return!_0x2a2a9c&&_0x38e41f[_0x529da9(0xfd)](0x194),_0x2a2a9c;};}function handleError(_0xbb8abc,_0x22f9a1){return _0x22f9a1=_0x22f9a1||0x1f4,function(_0x22f18d){const _0x2dda83=a400_0x5384;logger[_0x2dda83(0xda)](_0x22f18d['stack']),_0x22f18d[_0x2dda83(0xe5)]&&delete _0x22f18d[_0x2dda83(0xe5)],_0xbb8abc[_0x2dda83(0xf5)](_0x22f9a1)[_0x2dda83(0x115)](_0x22f18d);};}exports[a400_0x238239(0xdc)]=function(_0x2f9d28,_0x3f1d74){const _0x3dad02=a400_0x238239;let _0x525ead={};const _0x3e1a3e={},_0x100d10={'count':0x0,'rows':[]},_0x328b47=_['map'](db[_0x3dad02(0xf6)][_0x3dad02(0xcf)],function(_0x314b60){const _0x9680b9=_0x3dad02;return{'name':_0x314b60[_0x9680b9(0xea)],'type':_0x314b60[_0x9680b9(0xf0)][_0x9680b9(0xf9)]};});_0x3e1a3e[_0x3dad02(0x128)]=_[_0x3dad02(0x118)](_0x328b47,_0x3dad02(0xe5)),_0x3e1a3e['query']=_['keys'](_0x2f9d28['query']),_0x3e1a3e[_0x3dad02(0x10a)]=_[_0x3dad02(0x10b)](_0x3e1a3e[_0x3dad02(0x128)],_0x3e1a3e[_0x3dad02(0x102)]),_0x525ead['attributes']=_[_0x3dad02(0x10b)](_0x3e1a3e['model'],qs[_0x3dad02(0xdd)](_0x2f9d28[_0x3dad02(0x102)][_0x3dad02(0xdd)])),_0x525ead[_0x3dad02(0x107)]=_0x525ead[_0x3dad02(0x107)]['length']?_0x525ead[_0x3dad02(0x107)]:_0x3e1a3e[_0x3dad02(0x128)];typeof _0x2f9d28['query']['nolimit']===_0x3dad02(0xf4)&&(_0x525ead[_0x3dad02(0xcc)]=qs[_0x3dad02(0xcc)](_0x2f9d28[_0x3dad02(0x102)]['limit']),_0x525ead[_0x3dad02(0xe9)]=qs[_0x3dad02(0xe9)](_0x2f9d28[_0x3dad02(0x102)]['offset']));_0x525ead[_0x3dad02(0xd8)]=qs['sort'](_0x2f9d28['query']['sort']),_0x525ead[_0x3dad02(0xe2)]=qs[_0x3dad02(0x10a)](_[_0x3dad02(0xca)](_0x2f9d28[_0x3dad02(0x102)],_0x3e1a3e[_0x3dad02(0x10a)]),_0x328b47);_0x2f9d28[_0x3dad02(0x102)][_0x3dad02(0xe8)]&&(_0x525ead[_0x3dad02(0xe2)]=_['merge'](_0x525ead[_0x3dad02(0xe2)],{[Op['or']]:_[_0x3dad02(0x118)](_0x328b47,function(_0x2de9c9){const _0xd124b1=_0x3dad02;if(_0x2de9c9[_0xd124b1(0xf0)]!==_0xd124b1(0x10c)){const _0x5a48f8={};return _0x5a48f8[_0x2de9c9[_0xd124b1(0xe5)]]={[Op[_0xd124b1(0x11d)]]:'%'+_0x2f9d28[_0xd124b1(0x102)]['filter']+'%'},_0x5a48f8;}})}));_0x525ead=_[_0x3dad02(0x104)]({},_0x525ead,_0x2f9d28[_0x3dad02(0x10d)]);const _0x91f38f={'where':_0x525ead[_0x3dad02(0xe2)]};return db[_0x3dad02(0xf6)][_0x3dad02(0x122)](_0x91f38f)[_0x3dad02(0xee)](function(_0x1e1066){const _0x462121=_0x3dad02;return _0x100d10['count']=_0x1e1066,_0x2f9d28[_0x462121(0x102)][_0x462121(0x10f)]&&(_0x525ead[_0x462121(0x11a)]=[{'all':!![]}]),db[_0x462121(0xf6)]['findAll'](_0x525ead);})[_0x3dad02(0xee)](function(_0x222adc){const _0x47ba87=_0x3dad02;return _0x100d10[_0x47ba87(0x116)]=_0x222adc,_0x100d10;})[_0x3dad02(0xee)](respondWithFilteredResult(_0x3f1d74,_0x525ead))[_0x3dad02(0xdb)](handleError(_0x3f1d74,null));},exports['show']=function(_0x4b4c08,_0x1e8599){const _0x1d6329=a400_0x238239;let _0x15c3ce={'raw':![],'where':{'id':_0x4b4c08['params']['id']}};const _0x58999e={};return _0x58999e[_0x1d6329(0x128)]=_[_0x1d6329(0xe4)](db['ZendeskAccount'][_0x1d6329(0xcf)]),_0x58999e['query']=_[_0x1d6329(0xe4)](_0x4b4c08[_0x1d6329(0x102)]),_0x58999e['filters']=_[_0x1d6329(0x10b)](_0x58999e['model'],_0x58999e[_0x1d6329(0x102)]),_0x15c3ce[_0x1d6329(0x107)]=_[_0x1d6329(0x10b)](_0x58999e[_0x1d6329(0x128)],qs[_0x1d6329(0xdd)](_0x4b4c08['query'][_0x1d6329(0xdd)])),_0x15c3ce[_0x1d6329(0x107)]=_0x15c3ce[_0x1d6329(0x107)][_0x1d6329(0x106)]?_0x15c3ce[_0x1d6329(0x107)]:_0x58999e[_0x1d6329(0x128)],_0x4b4c08['query']['includeAll']&&(_0x15c3ce[_0x1d6329(0x11a)]=[{'all':!![]}]),_0x15c3ce=_['merge']({},_0x15c3ce,_0x4b4c08[_0x1d6329(0x10d)]),db[_0x1d6329(0xf6)][_0x1d6329(0x11b)](_0x15c3ce)['then'](handleEntityNotFound(_0x1e8599,null))['then'](respondWithResult(_0x1e8599,null))[_0x1d6329(0xdb)](handleError(_0x1e8599,null));},exports[a400_0x238239(0xf8)]=function(_0x300b7b,_0x315a90){const _0x34fa79=a400_0x238239;return db[_0x34fa79(0xf6)][_0x34fa79(0xf8)](_0x300b7b['body'],{})['then'](respondWithResult(_0x315a90,0xc9))[_0x34fa79(0xdb)](handleError(_0x315a90,null));},exports[a400_0x238239(0x103)]=function(_0x377ded,_0x46b5af){const _0x474db9=a400_0x238239;return _0x377ded[_0x474db9(0x12a)]['id']&&delete _0x377ded[_0x474db9(0x12a)]['id'],db['ZendeskAccount']['findOne']({'where':{'id':_0x377ded[_0x474db9(0x11c)]['id']}})['then'](handleEntityNotFound(_0x46b5af,null))[_0x474db9(0xee)](saveUpdates(_0x377ded[_0x474db9(0x12a)],null))[_0x474db9(0xee)](respondWithResult(_0x46b5af,null))[_0x474db9(0xdb)](handleError(_0x46b5af,null));},exports['destroy']=function(_0x5ff3a7,_0x4db926){const _0x4c2f46=a400_0x238239;return db[_0x4c2f46(0xf6)]['findOne']({'where':{'id':_0x5ff3a7[_0x4c2f46(0x11c)]['id']}})['then'](handleEntityNotFound(_0x4db926,null))[_0x4c2f46(0xee)](removeEntity(_0x4db926,null))[_0x4c2f46(0xdb)](handleError(_0x4db926,null));},exports[a400_0x238239(0xce)]=function(_0x2031a9,_0x26fed3){const _0x362cad=a400_0x238239;let _0x5ad0e8={};const _0x429809={};let _0x32b6d8,_0x4752b3;return db[_0x362cad(0xf6)]['findOne']({'where':{'id':_0x2031a9[_0x362cad(0x11c)]['id']}})[_0x362cad(0xee)](handleEntityNotFound(_0x26fed3,null))[_0x362cad(0xee)](function(_0x2d6c3b){const _0x304924=_0x362cad;if(_0x2d6c3b)return _0x32b6d8=_0x2d6c3b,_0x429809[_0x304924(0x128)]=_[_0x304924(0xe4)](db[_0x304924(0xd3)][_0x304924(0xcf)]),_0x429809[_0x304924(0x102)]=_[_0x304924(0xe4)](_0x2031a9[_0x304924(0x102)]),_0x429809['filters']=_[_0x304924(0x10b)](_0x429809[_0x304924(0x128)],_0x429809['query']),_0x5ad0e8[_0x304924(0x107)]=_['intersection'](_0x429809[_0x304924(0x128)],qs[_0x304924(0xdd)](_0x2031a9[_0x304924(0x102)]['fields'])),_0x5ad0e8[_0x304924(0x107)]=_0x5ad0e8[_0x304924(0x107)]['length']?_0x5ad0e8[_0x304924(0x107)]:_0x429809[_0x304924(0x128)],_0x5ad0e8['order']=qs[_0x304924(0x125)](_0x2031a9[_0x304924(0x102)][_0x304924(0x125)]),_0x5ad0e8[_0x304924(0xe2)]=qs[_0x304924(0x10a)](_['pick'](_0x2031a9['query'],_0x429809[_0x304924(0x10a)])),_0x2031a9[_0x304924(0x102)][_0x304924(0xe8)]&&(_0x5ad0e8[_0x304924(0xe2)]=_[_0x304924(0x104)](_0x5ad0e8['where'],{[Op['or']]:_[_0x304924(0x118)](_0x5ad0e8[_0x304924(0x107)],function(_0x4fb83d){const _0x271336=_0x304924,_0x2b097b={};return _0x2b097b[_0x4fb83d]={[Op[_0x271336(0x11d)]]:'%'+_0x2031a9[_0x271336(0x102)]['filter']+'%'},_0x2b097b;})})),_0x5ad0e8=_['merge']({},_0x5ad0e8,_0x2031a9['options']),_0x32b6d8[_0x304924(0xce)](_0x5ad0e8);})[_0x362cad(0xee)](function(_0x4c6abf){const _0x3acb2c=_0x362cad;if(_0x4c6abf)return _0x4752b3=_0x4c6abf['length'],typeof _0x2031a9[_0x3acb2c(0x102)][_0x3acb2c(0xe1)]===_0x3acb2c(0xf4)&&(_0x5ad0e8[_0x3acb2c(0xcc)]=qs['limit'](_0x2031a9[_0x3acb2c(0x102)]['limit']),_0x5ad0e8[_0x3acb2c(0xe9)]=qs['offset'](_0x2031a9[_0x3acb2c(0x102)][_0x3acb2c(0xe9)])),_0x32b6d8[_0x3acb2c(0xce)](_0x5ad0e8);})[_0x362cad(0xee)](function(_0x1721d1){if(_0x1721d1)return _0x1721d1?{'count':_0x4752b3,'rows':_0x1721d1}:null;})[_0x362cad(0xee)](respondWithResult(_0x26fed3,null))[_0x362cad(0xdb)](handleError(_0x26fed3,null));},exports[a400_0x238239(0x10e)]=function(_0x4bd56a,_0x479e34){const _0x5947a9=a400_0x238239;return _0x4bd56a[_0x5947a9(0x12a)]['id']&&delete _0x4bd56a[_0x5947a9(0x12a)]['id'],db[_0x5947a9(0xf6)][_0x5947a9(0x11b)]({'where':{'id':_0x4bd56a[_0x5947a9(0x11c)]['id']}})[_0x5947a9(0xee)](handleEntityNotFound(_0x479e34,null))[_0x5947a9(0xee)](function(_0x5d7d2e){const _0x290494=_0x5947a9;if(_0x5d7d2e)return _0x4bd56a['body']['AccountId']=_0x5d7d2e['id'],_0x4bd56a[_0x290494(0x12a)]['Subjects']=integrations[_0x290494(0x105)](_0x4bd56a[_0x290494(0x12a)]['channel'],_0x4bd56a[_0x290494(0x12a)][_0x290494(0xf0)]),_0x4bd56a['body']['Descriptions']=integrations[_0x290494(0x113)](_0x4bd56a['body']['channel'],_0x4bd56a[_0x290494(0x12a)][_0x290494(0xf0)]),db[_0x290494(0xd3)]['create'](_0x4bd56a[_0x290494(0x12a)],{'include':[{'model':db[_0x290494(0xd4)],'as':_0x290494(0x100)},{'model':db[_0x290494(0xd4)],'as':_0x290494(0xdf)}]});return null;})['then'](respondWithResult(_0x479e34,null))[_0x5947a9(0xdb)](handleError(_0x479e34,null));},exports[a400_0x238239(0xf2)]=function(_0x36edf4,_0x6434c1){const _0x345444=a400_0x238239;let _0xb8e6ad='';return db[_0x345444(0xf6)][_0x345444(0x11b)]({'where':{'id':_0x36edf4['params']['id']},'attributes':['id',_0x345444(0xd2),_0x345444(0x120),_0x345444(0x123),'authType',_0x345444(0x11f)]})[_0x345444(0xee)](handleEntityNotFound(_0x6434c1,null))[_0x345444(0xee)](function(_0x32c04f){const _0x2956a9=_0x345444;if(_0x32c04f){_0xb8e6ad=_0x32c04f['remoteUri'];const _0x1ba8aa=_0xb8e6ad[_0x2956a9(0x121)](-0x1);_0x1ba8aa==='/'&&(_0xb8e6ad=_0xb8e6ad[_0x2956a9(0xfb)](0x0,_0xb8e6ad[_0x2956a9(0x129)](_0x1ba8aa)));const _0x380399={'method':_0x2956a9(0x108),'uri':util[_0x2956a9(0xd5)](_0x2956a9(0xfa),_0xb8e6ad,_0x2956a9(0x111)),'json':!![]};switch(_0x32c04f[_0x2956a9(0x109)]){case _0x2956a9(0x120):_0x380399[_0x2956a9(0xcb)]={'Authorization':util[_0x2956a9(0xd5)](_0x2956a9(0xfc),Buffer[_0x2956a9(0xe3)](util[_0x2956a9(0xd5)](_0x2956a9(0xd0),_0x32c04f[_0x2956a9(0xd2)],_0x32c04f[_0x2956a9(0x120)]))[_0x2956a9(0xef)]('base64'))};break;case'token':_0x380399['headers']={'Authorization':util['format'](_0x2956a9(0xfc),Buffer[_0x2956a9(0xe3)](util[_0x2956a9(0xd5)](_0x2956a9(0xc9),_0x32c04f[_0x2956a9(0xd2)],_0x32c04f['token']))[_0x2956a9(0xef)](_0x2956a9(0xd9)))};break;default:throw new ValidationError(_0x2956a9(0x112));}return rp(_0x380399);}})[_0x345444(0xee)](function(_0x5a63e8){const _0x251a7b=_0x345444;if(_0x5a63e8){const _0x2c45e4=[_0x251a7b(0xf7),_0x251a7b(0xe7),_0x251a7b(0xff),'assignee'];return _['remove'](_0x5a63e8[_0x251a7b(0x111)],function(_0x55d4c2){const _0x2b3f1f=_0x251a7b;return _0x2c45e4[_0x2b3f1f(0x101)](_0x55d4c2[_0x2b3f1f(0xf0)]);}),{'count':_0x5a63e8[_0x251a7b(0x111)][_0x251a7b(0x106)],'rows':_[_0x251a7b(0x118)](_0x5a63e8['ticket_fields'],function(_0x3ff6ab){const _0xde8915=_0x251a7b;return{'id':_0x3ff6ab['id'],'name':_0x3ff6ab[_0xde8915(0x126)]>0x7?_0x3ff6ab[_0xde8915(0x127)]:_0x3ff6ab[_0xde8915(0xf0)],'custom':_0x3ff6ab[_0xde8915(0x126)]>0x7?!![]:![],'options':_0x3ff6ab['system_field_options']?_0x3ff6ab[_0xde8915(0x119)]:_0x3ff6ab[_0xde8915(0xd7)]?_0x3ff6ab['custom_field_options']:[]};})};}})[_0x345444(0xee)](respondWithResult(_0x6434c1,null))['catch'](function(_0x1a3c92){const _0x35f63e=_0x345444;let _0xe3ee93=_0x36edf4[_0x35f63e(0x102)][_0x35f63e(0x110)]?0x1f4:_0x1a3c92[_0x35f63e(0x117)]||0x1f4;logger[_0x35f63e(0xda)](_0x35f63e(0xed),'getFields',_0xe3ee93,JSON[_0x35f63e(0xe0)](_0x1a3c92)),delete _0x1a3c92['name'],_0xe3ee93===0x191&&(_0xe3ee93=0x190),_0x6434c1[_0x35f63e(0xf5)](_0xe3ee93)[_0x35f63e(0x115)](_0x36edf4[_0x35f63e(0x102)]['test']?{'message':_0x35f63e(0xf1),'statusCode':_0x1a3c92['statusCode']}:_0x1a3c92);});};
\ No newline at end of file
+const a400_0x45da=['api','getConfigurations','Unknown\x20authentication\x20type','order','options','sort','count','AccountId','send','system_field_options','group','includeAll','username','fields','channel','findOne','token','assignee','VIRTUAL','params','catch','filter','lastIndexOf','rows','show','ZendeskField','getFields','ZendeskConfiguration','intersection','json','create','fieldName','then','undefined','statusCode','rawAttributes','attributes','%s:%s','../../components/parsers/qs','Descriptions','error','limit','substring','base64','name','../../components/integrations/configuration','Subjects','merge','pick','stack','position','lodash','key','util','title','ticket_fields','include','headers','test','keys','toString','offset','subject','from','index','getSubjects','map','remove','GET','update','status','Basic\x20%s','set','nolimit','stringify','includes','request-promise-native','password','ZendeskAccount','destroy','body','filters','../../config/logger','like','description','../../mysqldb','model','remoteUri','query','length','where','findAll','sendStatus','custom_field_options','format','type'];(function(_0x38e8d5,_0x13ac8b){const _0x45da15=function(_0x1b6dc4){while(--_0x1b6dc4){_0x38e8d5['push'](_0x38e8d5['shift']());}};_0x45da15(++_0x13ac8b);}(a400_0x45da,0x188));const a400_0x1b6d=function(_0x38e8d5,_0x13ac8b){_0x38e8d5=_0x38e8d5-0xe3;let _0x45da15=a400_0x45da[_0x38e8d5];return _0x45da15;};const a400_0x2b4d4b=a400_0x1b6d;'use strict';const rp=require(a400_0x2b4d4b(0x127)),util=require(a400_0x2b4d4b(0x110)),_=require(a400_0x2b4d4b(0x10e)),qs=require(a400_0x2b4d4b(0x101)),logger=require(a400_0x2b4d4b(0x12d))(a400_0x2b4d4b(0x13b)),{db}=require(a400_0x2b4d4b(0x130)),{Op,ValidationError}=require('sequelize'),integrations=require(a400_0x2b4d4b(0x108));function respondWithResult(_0xe7e6eb,_0x2adcf2){return _0x2adcf2=_0x2adcf2||0xc8,function(_0x49f5b0){const _0x421dc7=a400_0x1b6d;if(_0x49f5b0)return _0xe7e6eb[_0x421dc7(0x121)](_0x2adcf2)[_0x421dc7(0xf8)](_0x49f5b0);};}function respondWithFilteredResult(_0x462e27,_0x3c0f3f){return function(_0xf26abc){const _0x25dc09=a400_0x1b6d;if(_0xf26abc){const _0x27914c=_0xf26abc['count'],_0x2f8eb4=_0x3c0f3f[_0x25dc09(0x118)];let _0x1a5afb=_0x3c0f3f[_0x25dc09(0x118)]+_0x3c0f3f[_0x25dc09(0x104)],_0x754359;return _0x1a5afb>=_0x27914c?(_0x1a5afb=_0x27914c,_0x754359=0xc8):_0x754359=0xce,_0x462e27[_0x25dc09(0x121)](_0x754359),_0x462e27[_0x25dc09(0x123)]('Content-Range',_0x2f8eb4+'-'+_0x1a5afb+'/'+_0x27914c)['json'](_0xf26abc);}return null;};}function saveUpdates(_0x6afd6e){return function(_0x50726a){const _0x59472c=a400_0x1b6d;if(_0x50726a)return _0x50726a[_0x59472c(0x120)](_0x6afd6e)[_0x59472c(0xfb)](function(_0x225554){return _0x225554;});return null;};}function removeEntity(_0x254770){return function(_0x2bcbe7){const _0x26c490=a400_0x1b6d;if(_0x2bcbe7)return _0x2bcbe7[_0x26c490(0x12a)]()[_0x26c490(0xfb)](function(){const _0x90db62=_0x26c490;_0x254770[_0x90db62(0x121)](0xcc)['end']();});};}function handleEntityNotFound(_0x4dc804){return function(_0x851d05){const _0x1f7654=a400_0x1b6d;return!_0x851d05&&_0x4dc804[_0x1f7654(0x137)](0x194),_0x851d05;};}function handleError(_0x3657d8,_0xacaf03){return _0xacaf03=_0xacaf03||0x1f4,function(_0x5205e2){const _0x443d93=a400_0x1b6d;logger['error'](_0x5205e2[_0x443d93(0x10c)]),_0x5205e2[_0x443d93(0x107)]&&delete _0x5205e2[_0x443d93(0x107)],_0x3657d8[_0x443d93(0x121)](_0xacaf03)[_0x443d93(0xe3)](_0x5205e2);};}exports[a400_0x2b4d4b(0x11b)]=function(_0x2f7fdd,_0x1f741d){const _0x1c8e2c=a400_0x2b4d4b;let _0x2b2e70={};const _0x33d2b6={},_0x360158={'count':0x0,'rows':[]},_0x202990=_[_0x1c8e2c(0x11d)](db[_0x1c8e2c(0x129)][_0x1c8e2c(0xfe)],function(_0xf9ff0e){const _0x31a476=_0x1c8e2c;return{'name':_0xf9ff0e[_0x31a476(0xfa)],'type':_0xf9ff0e['type'][_0x31a476(0x10f)]};});_0x33d2b6[_0x1c8e2c(0x131)]=_[_0x1c8e2c(0x11d)](_0x202990,_0x1c8e2c(0x107)),_0x33d2b6[_0x1c8e2c(0x133)]=_[_0x1c8e2c(0x116)](_0x2f7fdd[_0x1c8e2c(0x133)]),_0x33d2b6[_0x1c8e2c(0x12c)]=_[_0x1c8e2c(0xf7)](_0x33d2b6[_0x1c8e2c(0x131)],_0x33d2b6[_0x1c8e2c(0x133)]),_0x2b2e70[_0x1c8e2c(0xff)]=_[_0x1c8e2c(0xf7)](_0x33d2b6['model'],qs[_0x1c8e2c(0xe8)](_0x2f7fdd[_0x1c8e2c(0x133)][_0x1c8e2c(0xe8)])),_0x2b2e70[_0x1c8e2c(0xff)]=_0x2b2e70[_0x1c8e2c(0xff)][_0x1c8e2c(0x134)]?_0x2b2e70[_0x1c8e2c(0xff)]:_0x33d2b6[_0x1c8e2c(0x131)];typeof _0x2f7fdd[_0x1c8e2c(0x133)]['nolimit']===_0x1c8e2c(0xfc)&&(_0x2b2e70[_0x1c8e2c(0x104)]=qs[_0x1c8e2c(0x104)](_0x2f7fdd[_0x1c8e2c(0x133)]['limit']),_0x2b2e70['offset']=qs['offset'](_0x2f7fdd[_0x1c8e2c(0x133)][_0x1c8e2c(0x118)]));_0x2b2e70[_0x1c8e2c(0x13e)]=qs[_0x1c8e2c(0x140)](_0x2f7fdd[_0x1c8e2c(0x133)][_0x1c8e2c(0x140)]),_0x2b2e70[_0x1c8e2c(0x135)]=qs[_0x1c8e2c(0x12c)](_[_0x1c8e2c(0x10b)](_0x2f7fdd[_0x1c8e2c(0x133)],_0x33d2b6['filters']),_0x202990);_0x2f7fdd[_0x1c8e2c(0x133)][_0x1c8e2c(0xf0)]&&(_0x2b2e70[_0x1c8e2c(0x135)]=_['merge'](_0x2b2e70[_0x1c8e2c(0x135)],{[Op['or']]:_['map'](_0x202990,function(_0x5e532d){const _0xf6ee2a=_0x1c8e2c;if(_0x5e532d[_0xf6ee2a(0x13a)]!==_0xf6ee2a(0xed)){const _0x62bc5e={};return _0x62bc5e[_0x5e532d[_0xf6ee2a(0x107)]]={[Op[_0xf6ee2a(0x12e)]]:'%'+_0x2f7fdd[_0xf6ee2a(0x133)][_0xf6ee2a(0xf0)]+'%'},_0x62bc5e;}})}));_0x2b2e70=_[_0x1c8e2c(0x10a)]({},_0x2b2e70,_0x2f7fdd[_0x1c8e2c(0x13f)]);const _0x187df8={'where':_0x2b2e70['where']};return db[_0x1c8e2c(0x129)][_0x1c8e2c(0x141)](_0x187df8)[_0x1c8e2c(0xfb)](function(_0x349933){const _0x22476e=_0x1c8e2c;return _0x360158[_0x22476e(0x141)]=_0x349933,_0x2f7fdd[_0x22476e(0x133)][_0x22476e(0xe6)]&&(_0x2b2e70['include']=[{'all':!![]}]),db[_0x22476e(0x129)][_0x22476e(0x136)](_0x2b2e70);})[_0x1c8e2c(0xfb)](function(_0x38cfe0){const _0xcd1f7a=_0x1c8e2c;return _0x360158[_0xcd1f7a(0xf2)]=_0x38cfe0,_0x360158;})[_0x1c8e2c(0xfb)](respondWithFilteredResult(_0x1f741d,_0x2b2e70))[_0x1c8e2c(0xef)](handleError(_0x1f741d,null));},exports[a400_0x2b4d4b(0xf3)]=function(_0x3d000a,_0x1c5763){const _0x43842a=a400_0x2b4d4b;let _0x5f09f0={'raw':![],'where':{'id':_0x3d000a[_0x43842a(0xee)]['id']}};const _0xe1c2c4={};return _0xe1c2c4[_0x43842a(0x131)]=_['keys'](db[_0x43842a(0x129)][_0x43842a(0xfe)]),_0xe1c2c4['query']=_[_0x43842a(0x116)](_0x3d000a['query']),_0xe1c2c4['filters']=_[_0x43842a(0xf7)](_0xe1c2c4[_0x43842a(0x131)],_0xe1c2c4[_0x43842a(0x133)]),_0x5f09f0[_0x43842a(0xff)]=_[_0x43842a(0xf7)](_0xe1c2c4[_0x43842a(0x131)],qs[_0x43842a(0xe8)](_0x3d000a['query'][_0x43842a(0xe8)])),_0x5f09f0['attributes']=_0x5f09f0['attributes'][_0x43842a(0x134)]?_0x5f09f0['attributes']:_0xe1c2c4[_0x43842a(0x131)],_0x3d000a[_0x43842a(0x133)][_0x43842a(0xe6)]&&(_0x5f09f0[_0x43842a(0x113)]=[{'all':!![]}]),_0x5f09f0=_[_0x43842a(0x10a)]({},_0x5f09f0,_0x3d000a['options']),db['ZendeskAccount'][_0x43842a(0xea)](_0x5f09f0)['then'](handleEntityNotFound(_0x1c5763,null))[_0x43842a(0xfb)](respondWithResult(_0x1c5763,null))['catch'](handleError(_0x1c5763,null));},exports[a400_0x2b4d4b(0xf9)]=function(_0x4980e3,_0xad3549){const _0xac66b7=a400_0x2b4d4b;return db[_0xac66b7(0x129)]['create'](_0x4980e3[_0xac66b7(0x12b)],{})['then'](respondWithResult(_0xad3549,0xc9))[_0xac66b7(0xef)](handleError(_0xad3549,null));},exports[a400_0x2b4d4b(0x120)]=function(_0x102946,_0x345691){const _0x5dc35f=a400_0x2b4d4b;return _0x102946['body']['id']&&delete _0x102946[_0x5dc35f(0x12b)]['id'],db[_0x5dc35f(0x129)]['findOne']({'where':{'id':_0x102946[_0x5dc35f(0xee)]['id']}})[_0x5dc35f(0xfb)](handleEntityNotFound(_0x345691,null))[_0x5dc35f(0xfb)](saveUpdates(_0x102946[_0x5dc35f(0x12b)],null))[_0x5dc35f(0xfb)](respondWithResult(_0x345691,null))[_0x5dc35f(0xef)](handleError(_0x345691,null));},exports['destroy']=function(_0x43ffbd,_0x3e4191){const _0x592f0b=a400_0x2b4d4b;return db[_0x592f0b(0x129)][_0x592f0b(0xea)]({'where':{'id':_0x43ffbd[_0x592f0b(0xee)]['id']}})[_0x592f0b(0xfb)](handleEntityNotFound(_0x3e4191,null))[_0x592f0b(0xfb)](removeEntity(_0x3e4191,null))[_0x592f0b(0xef)](handleError(_0x3e4191,null));},exports[a400_0x2b4d4b(0x13c)]=function(_0x37ae3a,_0x191b1a){const _0x68721d=a400_0x2b4d4b;let _0x20f476={};const _0x4e2991={};let _0x2b7a98,_0x339c69;return db[_0x68721d(0x129)]['findOne']({'where':{'id':_0x37ae3a[_0x68721d(0xee)]['id']}})[_0x68721d(0xfb)](handleEntityNotFound(_0x191b1a,null))[_0x68721d(0xfb)](function(_0x10ad7f){const _0x2e6c1b=_0x68721d;if(_0x10ad7f)return _0x2b7a98=_0x10ad7f,_0x4e2991[_0x2e6c1b(0x131)]=_['keys'](db['ZendeskConfiguration'][_0x2e6c1b(0xfe)]),_0x4e2991['query']=_[_0x2e6c1b(0x116)](_0x37ae3a[_0x2e6c1b(0x133)]),_0x4e2991[_0x2e6c1b(0x12c)]=_[_0x2e6c1b(0xf7)](_0x4e2991[_0x2e6c1b(0x131)],_0x4e2991[_0x2e6c1b(0x133)]),_0x20f476[_0x2e6c1b(0xff)]=_[_0x2e6c1b(0xf7)](_0x4e2991['model'],qs[_0x2e6c1b(0xe8)](_0x37ae3a[_0x2e6c1b(0x133)][_0x2e6c1b(0xe8)])),_0x20f476[_0x2e6c1b(0xff)]=_0x20f476[_0x2e6c1b(0xff)][_0x2e6c1b(0x134)]?_0x20f476['attributes']:_0x4e2991[_0x2e6c1b(0x131)],_0x20f476['order']=qs['sort'](_0x37ae3a[_0x2e6c1b(0x133)][_0x2e6c1b(0x140)]),_0x20f476[_0x2e6c1b(0x135)]=qs['filters'](_[_0x2e6c1b(0x10b)](_0x37ae3a[_0x2e6c1b(0x133)],_0x4e2991[_0x2e6c1b(0x12c)])),_0x37ae3a[_0x2e6c1b(0x133)][_0x2e6c1b(0xf0)]&&(_0x20f476[_0x2e6c1b(0x135)]=_['merge'](_0x20f476[_0x2e6c1b(0x135)],{[Op['or']]:_[_0x2e6c1b(0x11d)](_0x20f476[_0x2e6c1b(0xff)],function(_0x320fc5){const _0x51a4fc=_0x2e6c1b,_0x3478a5={};return _0x3478a5[_0x320fc5]={[Op[_0x51a4fc(0x12e)]]:'%'+_0x37ae3a[_0x51a4fc(0x133)]['filter']+'%'},_0x3478a5;})})),_0x20f476=_[_0x2e6c1b(0x10a)]({},_0x20f476,_0x37ae3a[_0x2e6c1b(0x13f)]),_0x2b7a98[_0x2e6c1b(0x13c)](_0x20f476);})[_0x68721d(0xfb)](function(_0x509496){const _0x184218=_0x68721d;if(_0x509496)return _0x339c69=_0x509496[_0x184218(0x134)],typeof _0x37ae3a['query'][_0x184218(0x124)]===_0x184218(0xfc)&&(_0x20f476[_0x184218(0x104)]=qs[_0x184218(0x104)](_0x37ae3a[_0x184218(0x133)][_0x184218(0x104)]),_0x20f476[_0x184218(0x118)]=qs[_0x184218(0x118)](_0x37ae3a[_0x184218(0x133)][_0x184218(0x118)])),_0x2b7a98[_0x184218(0x13c)](_0x20f476);})[_0x68721d(0xfb)](function(_0x47096a){if(_0x47096a)return _0x47096a?{'count':_0x339c69,'rows':_0x47096a}:null;})[_0x68721d(0xfb)](respondWithResult(_0x191b1a,null))[_0x68721d(0xef)](handleError(_0x191b1a,null));},exports['addConfiguration']=function(_0x2e1c5b,_0xac383b){const _0x4f52ff=a400_0x2b4d4b;return _0x2e1c5b[_0x4f52ff(0x12b)]['id']&&delete _0x2e1c5b[_0x4f52ff(0x12b)]['id'],db[_0x4f52ff(0x129)][_0x4f52ff(0xea)]({'where':{'id':_0x2e1c5b[_0x4f52ff(0xee)]['id']}})['then'](handleEntityNotFound(_0xac383b,null))[_0x4f52ff(0xfb)](function(_0x2fa2f9){const _0x20c591=_0x4f52ff;if(_0x2fa2f9)return _0x2e1c5b['body'][_0x20c591(0x142)]=_0x2fa2f9['id'],_0x2e1c5b[_0x20c591(0x12b)]['Subjects']=integrations[_0x20c591(0x11c)](_0x2e1c5b[_0x20c591(0x12b)][_0x20c591(0xe9)],_0x2e1c5b[_0x20c591(0x12b)]['type']),_0x2e1c5b[_0x20c591(0x12b)]['Descriptions']=integrations['getDescriptions'](_0x2e1c5b[_0x20c591(0x12b)][_0x20c591(0xe9)],_0x2e1c5b[_0x20c591(0x12b)][_0x20c591(0x13a)]),db[_0x20c591(0xf6)]['create'](_0x2e1c5b[_0x20c591(0x12b)],{'include':[{'model':db[_0x20c591(0xf4)],'as':_0x20c591(0x109)},{'model':db[_0x20c591(0xf4)],'as':_0x20c591(0x102)}]});return null;})['then'](respondWithResult(_0xac383b,null))[_0x4f52ff(0xef)](handleError(_0xac383b,null));},exports[a400_0x2b4d4b(0xf5)]=function(_0x576b34,_0x4e367a){const _0x1a4bdd=a400_0x2b4d4b;let _0x29b072='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x576b34[_0x1a4bdd(0xee)]['id']},'attributes':['id','username',_0x1a4bdd(0x128),'token','authType',_0x1a4bdd(0x132)]})[_0x1a4bdd(0xfb)](handleEntityNotFound(_0x4e367a,null))[_0x1a4bdd(0xfb)](function(_0x3b9bcb){const _0x4fea9d=_0x1a4bdd;if(_0x3b9bcb){_0x29b072=_0x3b9bcb[_0x4fea9d(0x132)];const _0xfdf7a2=_0x29b072['slice'](-0x1);_0xfdf7a2==='/'&&(_0x29b072=_0x29b072[_0x4fea9d(0x105)](0x0,_0x29b072[_0x4fea9d(0xf1)](_0xfdf7a2)));const _0x360b12={'method':_0x4fea9d(0x11f),'uri':util[_0x4fea9d(0x139)]('%s/%s',_0x29b072,_0x4fea9d(0x112)),'json':!![]};switch(_0x3b9bcb['authType']){case _0x4fea9d(0x128):_0x360b12['headers']={'Authorization':util[_0x4fea9d(0x139)](_0x4fea9d(0x122),Buffer[_0x4fea9d(0x11a)](util[_0x4fea9d(0x139)](_0x4fea9d(0x100),_0x3b9bcb[_0x4fea9d(0xe7)],_0x3b9bcb[_0x4fea9d(0x128)]))['toString'](_0x4fea9d(0x106)))};break;case _0x4fea9d(0xeb):_0x360b12[_0x4fea9d(0x114)]={'Authorization':util[_0x4fea9d(0x139)](_0x4fea9d(0x122),Buffer[_0x4fea9d(0x11a)](util[_0x4fea9d(0x139)]('%s/token:%s',_0x3b9bcb[_0x4fea9d(0xe7)],_0x3b9bcb[_0x4fea9d(0xeb)]))[_0x4fea9d(0x117)]('base64'))};break;default:throw new ValidationError(_0x4fea9d(0x13d));}return rp(_0x360b12);}})[_0x1a4bdd(0xfb)](function(_0x43e669){const _0x44cfeb=_0x1a4bdd;if(_0x43e669){const _0x143288=[_0x44cfeb(0x119),_0x44cfeb(0x12f),_0x44cfeb(0xe5),_0x44cfeb(0xec)];return _[_0x44cfeb(0x11e)](_0x43e669[_0x44cfeb(0x112)],function(_0x8d05e6){const _0x104673=_0x44cfeb;return _0x143288[_0x104673(0x126)](_0x8d05e6[_0x104673(0x13a)]);}),{'count':_0x43e669[_0x44cfeb(0x112)][_0x44cfeb(0x134)],'rows':_['map'](_0x43e669[_0x44cfeb(0x112)],function(_0x510b81){const _0x284960=_0x44cfeb;return{'id':_0x510b81['id'],'name':_0x510b81[_0x284960(0x10d)]>0x7?_0x510b81[_0x284960(0x111)]:_0x510b81[_0x284960(0x13a)],'custom':_0x510b81[_0x284960(0x10d)]>0x7?!![]:![],'options':_0x510b81[_0x284960(0xe4)]?_0x510b81[_0x284960(0xe4)]:_0x510b81['custom_field_options']?_0x510b81[_0x284960(0x138)]:[]};})};}})[_0x1a4bdd(0xfb)](respondWithResult(_0x4e367a,null))[_0x1a4bdd(0xef)](function(_0x273925){const _0x491182=_0x1a4bdd;let _0x3b4d63=_0x576b34[_0x491182(0x133)][_0x491182(0x115)]?0x1f4:_0x273925[_0x491182(0xfd)]||0x1f4;logger[_0x491182(0x103)]('getFields,\x20%s,\x20%s,\x20%s',_0x491182(0xf5),_0x3b4d63,JSON[_0x491182(0x125)](_0x273925)),delete _0x273925[_0x491182(0x107)],_0x3b4d63===0x191&&(_0x3b4d63=0x190),_0x4e367a[_0x491182(0x121)](_0x3b4d63)[_0x491182(0xe3)](_0x576b34[_0x491182(0x133)][_0x491182(0x115)]?{'message':'Wrong\x20credentials','statusCode':_0x273925[_0x491182(0xfd)]}:_0x273925);});};
\ No newline at end of file