Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / intZendeskAccount / intZendeskAccount.controller.js
index 2c7857d..e3b1e83 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfccf=['apply','reject','save','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','options','count','includeAll','include','findAll','rows','params','length','find','create','body','update','destroy','getConfigurations','findOne','keys','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','substring','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','description','group','includes','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set'];(function(_0x3096b1,_0x4adeeb){var _0x3885e4=function(_0x157e12){while(--_0x157e12){_0x3096b1['push'](_0x3096b1['shift']());}};_0x3885e4(++_0x4adeeb);}(_0xfccf,0x1d9));var _0xffcc=function(_0x271836,_0x256cd0){_0x271836=_0x271836-0x0;var _0x5dffbf=_0xfccf[_0x271836];return _0x5dffbf;};'use strict';var pdf=require(_0xffcc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xffcc('0x1'));var zipdir=require(_0xffcc('0x2'));var jsonpatch=require(_0xffcc('0x3'));var rp=require(_0xffcc('0x4'));var moment=require(_0xffcc('0x5'));var BPromise=require(_0xffcc('0x6'));var Mustache=require(_0xffcc('0x7'));var util=require(_0xffcc('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xffcc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xffcc('0xa'));var jsforce=require(_0xffcc('0xb'));var deskjs=require(_0xffcc('0xc'));var toCsv=require(_0xffcc('0xd'));var querystring=require(_0xffcc('0xe'));var Papa=require(_0xffcc('0xf'));var Redis=require(_0xffcc('0x10'));var authService=require(_0xffcc('0x11'));var qs=require(_0xffcc('0x12'));var as=require(_0xffcc('0x13'));var hardwareService=require(_0xffcc('0x14'));var logger=require(_0xffcc('0x15'))(_0xffcc('0x16'));var utils=require(_0xffcc('0x17'));var config=require(_0xffcc('0x18'));var db=require(_0xffcc('0x19'))['db'];var integrations=require(_0xffcc('0x1a'));var jayson=require(_0xffcc('0x1b'));var client=jayson[_0xffcc('0x1c')][_0xffcc('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x4d6e1a,_0x5dfbb0,_0x5999af){if(_0x5999af){var _0x9517c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9517c2[_0xffcc('0x1e')](_0x5dfbb0)){return _0x4d6e1a;}else{throw new db['Sequelize'][(_0xffcc('0x1f'))](_0xffcc('0x20'));}}else{return _0x4d6e1a;}}function respondWithRpcPromise(_0x526fcb,_0x888151,_0x37c2be,_0xf8ef97){return new BPromise(function(_0x210a1a,_0x57a03c){var _0x3427ae=_0xf8ef97||client;return _0x3427ae[_0xffcc('0x21')](_0x526fcb,_0x37c2be)['then'](function(_0x3c96d5){logger[_0xffcc('0x22')](_0xffcc('0x23'),_0x888151,_0xffcc('0x24'));logger['debug'](_0xffcc('0x25'),_0x888151,_0xffcc('0x24'),JSON[_0xffcc('0x26')](_0x3c96d5));if(_0x3c96d5[_0xffcc('0x27')]){if(_0x3c96d5[_0xffcc('0x27')][_0xffcc('0x28')]===0x1f4){logger[_0xffcc('0x27')](_0xffcc('0x23'),_0x888151,_0x3c96d5[_0xffcc('0x27')][_0xffcc('0x29')]);return _0x57a03c(_0x3c96d5[_0xffcc('0x27')][_0xffcc('0x29')]);}logger[_0xffcc('0x27')]('ZendeskAccount,\x20%s,\x20%s',_0x888151,_0x3c96d5[_0xffcc('0x27')][_0xffcc('0x29')]);return _0x210a1a(_0x3c96d5[_0xffcc('0x27')]['message']);}else{logger[_0xffcc('0x22')](_0xffcc('0x23'),_0x888151,'request\x20sent');_0x210a1a(_0x3c96d5[_0xffcc('0x2a')][_0xffcc('0x29')]);}})[_0xffcc('0x2b')](function(_0x1927ee){logger[_0xffcc('0x27')](_0xffcc('0x23'),_0x888151,_0x1927ee);_0x57a03c(_0x1927ee);});});}function respondWithStatusCode(_0x339f29,_0x276292){_0x276292=_0x276292||0xcc;return function(_0xaef15a){if(_0xaef15a){return _0x339f29[_0xffcc('0x2c')](_0x276292);}return _0x339f29[_0xffcc('0x2d')](_0x276292)[_0xffcc('0x2e')]();};}function respondWithResult(_0x48e29d,_0x18d82c){_0x18d82c=_0x18d82c||0xc8;return function(_0x533cae){if(_0x533cae){return _0x48e29d[_0xffcc('0x2d')](_0x18d82c)[_0xffcc('0x2f')](_0x533cae);}};}function respondWithFilteredResult(_0xd64fab,_0x156ac2){return function(_0x103298){if(_0x103298){var _0xbe842=_0x103298['count'],_0x5b9627=_0x156ac2[_0xffcc('0x30')],_0x74164=_0x156ac2[_0xffcc('0x30')]+_0x156ac2[_0xffcc('0x31')],_0x19a902;if(_0x74164>=_0xbe842){_0x74164=_0xbe842;_0x19a902=0xc8;}else{_0x19a902=0xce;}_0xd64fab['status'](_0x19a902);return _0xd64fab[_0xffcc('0x32')]('Content-Range',_0x5b9627+'-'+_0x74164+'/'+_0xbe842)[_0xffcc('0x2f')](_0x103298);}return null;};}function patchUpdates(_0x58d13b){return function(_0x24dc3c){try{jsonpatch[_0xffcc('0x33')](_0x24dc3c,_0x58d13b,!![]);}catch(_0x31b141){return BPromise[_0xffcc('0x34')](_0x31b141);}return _0x24dc3c[_0xffcc('0x35')]();};}function saveUpdates(_0x1af8a5,_0x2679e6){return function(_0x44230e){if(_0x44230e){return _0x44230e['update'](_0x1af8a5)[_0xffcc('0x36')](function(_0x4f0b98){return _0x4f0b98;});}return null;};}function removeEntity(_0x3d99c4,_0x1f1c3e){return function(_0x44f7e2){if(_0x44f7e2){return _0x44f7e2['destroy']()[_0xffcc('0x36')](function(){_0x3d99c4[_0xffcc('0x2d')](0xcc)[_0xffcc('0x2e')]();});}};}function handleEntityNotFound(_0x2f3af9,_0x391e71){return function(_0x19639d){if(!_0x19639d){_0x2f3af9[_0xffcc('0x2c')](0x194);}return _0x19639d;};}function handleError(_0x29f825,_0x365efb){_0x365efb=_0x365efb||0x1f4;return function(_0x535114){logger['error'](_0x535114[_0xffcc('0x37')]);if(_0x535114[_0xffcc('0x38')]){delete _0x535114['name'];}_0x29f825[_0xffcc('0x2d')](_0x365efb)[_0xffcc('0x39')](_0x535114);};}exports[_0xffcc('0x3a')]=function(_0x56be33,_0xc2a8fb){var _0x5c2964={},_0x599509={},_0x4851cf={'count':0x0,'rows':[]};var _0x37828c=_[_0xffcc('0x3b')](db[_0xffcc('0x3c')][_0xffcc('0x3d')],function(_0xe31aa9){return{'name':_0xe31aa9[_0xffcc('0x3e')],'type':_0xe31aa9[_0xffcc('0x3f')][_0xffcc('0x40')]};});_0x599509[_0xffcc('0x41')]=_[_0xffcc('0x3b')](_0x37828c,_0xffcc('0x38'));_0x599509[_0xffcc('0x42')]=_['keys'](_0x56be33[_0xffcc('0x42')]);_0x599509['filters']=_[_0xffcc('0x43')](_0x599509[_0xffcc('0x41')],_0x599509[_0xffcc('0x42')]);_0x5c2964[_0xffcc('0x44')]=_[_0xffcc('0x43')](_0x599509[_0xffcc('0x41')],qs[_0xffcc('0x45')](_0x56be33[_0xffcc('0x42')][_0xffcc('0x45')]));_0x5c2964[_0xffcc('0x44')]=_0x5c2964[_0xffcc('0x44')]['length']?_0x5c2964[_0xffcc('0x44')]:_0x599509[_0xffcc('0x41')];if(!_0x56be33[_0xffcc('0x42')][_0xffcc('0x46')]('nolimit')){_0x5c2964['limit']=qs[_0xffcc('0x31')](_0x56be33[_0xffcc('0x42')][_0xffcc('0x31')]);_0x5c2964[_0xffcc('0x30')]=qs[_0xffcc('0x30')](_0x56be33[_0xffcc('0x42')]['offset']);}_0x5c2964[_0xffcc('0x47')]=qs[_0xffcc('0x48')](_0x56be33['query'][_0xffcc('0x48')]);_0x5c2964[_0xffcc('0x49')]=qs[_0xffcc('0x4a')](_['pick'](_0x56be33[_0xffcc('0x42')],_0x599509['filters']),_0x37828c);if(_0x56be33[_0xffcc('0x42')][_0xffcc('0x4b')]){_0x5c2964[_0xffcc('0x49')]=_['merge'](_0x5c2964[_0xffcc('0x49')],{'$or':_[_0xffcc('0x3b')](_0x37828c,function(_0x2fb400){if(_0x2fb400[_0xffcc('0x3f')]!=='VIRTUAL'){var _0xc83db6={};_0xc83db6[_0x2fb400[_0xffcc('0x38')]]={'$like':'%'+_0x56be33['query'][_0xffcc('0x4b')]+'%'};return _0xc83db6;}})});}_0x5c2964=_[_0xffcc('0x4c')]({},_0x5c2964,_0x56be33[_0xffcc('0x4d')]);var _0x192179={'where':_0x5c2964[_0xffcc('0x49')]};return db[_0xffcc('0x3c')][_0xffcc('0x4e')](_0x192179)['then'](function(_0x37b686){_0x4851cf[_0xffcc('0x4e')]=_0x37b686;if(_0x56be33[_0xffcc('0x42')][_0xffcc('0x4f')]){_0x5c2964[_0xffcc('0x50')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xffcc('0x51')](_0x5c2964);})[_0xffcc('0x36')](function(_0x5576cf){_0x4851cf[_0xffcc('0x52')]=_0x5576cf;return _0x4851cf;})[_0xffcc('0x36')](respondWithFilteredResult(_0xc2a8fb,_0x5c2964))[_0xffcc('0x2b')](handleError(_0xc2a8fb,null));};exports['show']=function(_0x27b711,_0x3e8182){var _0x242e31={'raw':![],'where':{'id':_0x27b711[_0xffcc('0x53')]['id']}},_0x3e54a0={};_0x3e54a0[_0xffcc('0x41')]=_['keys'](db[_0xffcc('0x3c')][_0xffcc('0x3d')]);_0x3e54a0[_0xffcc('0x42')]=_['keys'](_0x27b711[_0xffcc('0x42')]);_0x3e54a0[_0xffcc('0x4a')]=_[_0xffcc('0x43')](_0x3e54a0[_0xffcc('0x41')],_0x3e54a0[_0xffcc('0x42')]);_0x242e31[_0xffcc('0x44')]=_[_0xffcc('0x43')](_0x3e54a0[_0xffcc('0x41')],qs[_0xffcc('0x45')](_0x27b711[_0xffcc('0x42')]['fields']));_0x242e31[_0xffcc('0x44')]=_0x242e31[_0xffcc('0x44')][_0xffcc('0x54')]?_0x242e31['attributes']:_0x3e54a0[_0xffcc('0x41')];if(_0x27b711[_0xffcc('0x42')][_0xffcc('0x4f')]){_0x242e31['include']=[{'all':!![]}];}_0x242e31=_[_0xffcc('0x4c')]({},_0x242e31,_0x27b711[_0xffcc('0x4d')]);return db['ZendeskAccount'][_0xffcc('0x55')](_0x242e31)[_0xffcc('0x36')](handleEntityNotFound(_0x3e8182,null))['then'](respondWithResult(_0x3e8182,null))[_0xffcc('0x2b')](handleError(_0x3e8182,null));};exports[_0xffcc('0x56')]=function(_0x5a5bbd,_0x4c1b9d){return db['ZendeskAccount'][_0xffcc('0x56')](_0x5a5bbd[_0xffcc('0x57')],{})['then'](respondWithResult(_0x4c1b9d,0xc9))[_0xffcc('0x2b')](handleError(_0x4c1b9d,null));};exports[_0xffcc('0x58')]=function(_0x24e752,_0x444b3f){if(_0x24e752[_0xffcc('0x57')]['id']){delete _0x24e752[_0xffcc('0x57')]['id'];}return db['ZendeskAccount'][_0xffcc('0x55')]({'where':{'id':_0x24e752['params']['id']}})[_0xffcc('0x36')](handleEntityNotFound(_0x444b3f,null))[_0xffcc('0x36')](saveUpdates(_0x24e752[_0xffcc('0x57')],null))[_0xffcc('0x36')](respondWithResult(_0x444b3f,null))[_0xffcc('0x2b')](handleError(_0x444b3f,null));};exports[_0xffcc('0x59')]=function(_0x5c6728,_0x7c8472){return db[_0xffcc('0x3c')][_0xffcc('0x55')]({'where':{'id':_0x5c6728[_0xffcc('0x53')]['id']}})[_0xffcc('0x36')](handleEntityNotFound(_0x7c8472,null))[_0xffcc('0x36')](removeEntity(_0x7c8472,null))[_0xffcc('0x2b')](handleError(_0x7c8472,null));};exports[_0xffcc('0x5a')]=function(_0x1e7cf4,_0x8fd18b,_0xf9a242){var _0x480d7e={};var _0x205e57={};var _0x450eb0;var _0x2bc875;return db['ZendeskAccount'][_0xffcc('0x5b')]({'where':{'id':_0x1e7cf4['params']['id']}})['then'](handleEntityNotFound(_0x8fd18b,null))[_0xffcc('0x36')](function(_0x398e15){if(_0x398e15){_0x450eb0=_0x398e15;_0x205e57[_0xffcc('0x41')]=_[_0xffcc('0x5c')](db[_0xffcc('0x5d')][_0xffcc('0x3d')]);_0x205e57[_0xffcc('0x42')]=_['keys'](_0x1e7cf4['query']);_0x205e57[_0xffcc('0x4a')]=_[_0xffcc('0x43')](_0x205e57['model'],_0x205e57[_0xffcc('0x42')]);_0x480d7e[_0xffcc('0x44')]=_[_0xffcc('0x43')](_0x205e57[_0xffcc('0x41')],qs['fields'](_0x1e7cf4['query'][_0xffcc('0x45')]));_0x480d7e[_0xffcc('0x44')]=_0x480d7e['attributes']['length']?_0x480d7e[_0xffcc('0x44')]:_0x205e57[_0xffcc('0x41')];_0x480d7e['order']=qs[_0xffcc('0x48')](_0x1e7cf4[_0xffcc('0x42')][_0xffcc('0x48')]);_0x480d7e[_0xffcc('0x49')]=qs[_0xffcc('0x4a')](_[_0xffcc('0x5e')](_0x1e7cf4[_0xffcc('0x42')],_0x205e57[_0xffcc('0x4a')]));if(_0x1e7cf4[_0xffcc('0x42')][_0xffcc('0x4b')]){_0x480d7e[_0xffcc('0x49')]=_[_0xffcc('0x4c')](_0x480d7e[_0xffcc('0x49')],{'$or':_[_0xffcc('0x3b')](_0x480d7e['attributes'],function(_0x4680cd){var _0xfdf98b={};_0xfdf98b[_0x4680cd]={'$like':'%'+_0x1e7cf4['query'][_0xffcc('0x4b')]+'%'};return _0xfdf98b;})});}_0x480d7e=_[_0xffcc('0x4c')]({},_0x480d7e,_0x1e7cf4[_0xffcc('0x4d')]);return _0x450eb0[_0xffcc('0x5a')](_0x480d7e);}})[_0xffcc('0x36')](function(_0xbb3784){if(_0xbb3784){_0x2bc875=_0xbb3784[_0xffcc('0x54')];if(!_0x1e7cf4[_0xffcc('0x42')]['hasOwnProperty'](_0xffcc('0x5f'))){_0x480d7e[_0xffcc('0x31')]=qs[_0xffcc('0x31')](_0x1e7cf4[_0xffcc('0x42')][_0xffcc('0x31')]);_0x480d7e[_0xffcc('0x30')]=qs[_0xffcc('0x30')](_0x1e7cf4[_0xffcc('0x42')][_0xffcc('0x30')]);}return _0x450eb0[_0xffcc('0x5a')](_0x480d7e);}})[_0xffcc('0x36')](function(_0x34d940){if(_0x34d940){return _0x34d940?{'count':_0x2bc875,'rows':_0x34d940}:null;}})[_0xffcc('0x36')](respondWithResult(_0x8fd18b,null))[_0xffcc('0x2b')](handleError(_0x8fd18b,null));};exports[_0xffcc('0x60')]=function(_0x209727,_0x4313a3,_0x59c892){if(_0x209727['body']['id']){delete _0x209727[_0xffcc('0x57')]['id'];}return db[_0xffcc('0x3c')]['findOne']({'where':{'id':_0x209727[_0xffcc('0x53')]['id']}})[_0xffcc('0x36')](handleEntityNotFound(_0x4313a3,null))[_0xffcc('0x36')](function(_0x39b65e){if(_0x39b65e){_0x209727[_0xffcc('0x57')][_0xffcc('0x61')]=_0x39b65e['id'];_0x209727[_0xffcc('0x57')][_0xffcc('0x62')]=integrations[_0xffcc('0x63')](_0x209727['body'][_0xffcc('0x64')],_0x209727[_0xffcc('0x57')][_0xffcc('0x3f')]);_0x209727[_0xffcc('0x57')][_0xffcc('0x65')]=integrations[_0xffcc('0x66')](_0x209727[_0xffcc('0x57')][_0xffcc('0x64')],_0x209727[_0xffcc('0x57')][_0xffcc('0x3f')]);return db[_0xffcc('0x5d')][_0xffcc('0x56')](_0x209727[_0xffcc('0x57')],{'include':[{'model':db[_0xffcc('0x67')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0xffcc('0x65')}]});}return null;})[_0xffcc('0x36')](respondWithResult(_0x4313a3,null))[_0xffcc('0x2b')](handleError(_0x4313a3,null));};exports[_0xffcc('0x68')]=function(_0x4f0ae1,_0x4129de,_0x396ebc){var _0xe4a119='';return db[_0xffcc('0x3c')][_0xffcc('0x5b')]({'where':{'id':_0x4f0ae1['params']['id']},'attributes':['id',_0xffcc('0x69'),_0xffcc('0x6a'),_0xffcc('0x6b'),_0xffcc('0x6c'),_0xffcc('0x6d')]})['then'](handleEntityNotFound(_0x4129de,null))[_0xffcc('0x36')](function(_0x3897b9){if(_0x3897b9){_0xe4a119=_0x3897b9[_0xffcc('0x6d')];var _0x2773b4=_0xe4a119['slice'](-0x1);if(_0x2773b4==='/'){_0xe4a119=_0xe4a119[_0xffcc('0x6e')](0x0,_0xe4a119['lastIndexOf'](_0x2773b4));}var _0x3e65f6={'method':_0xffcc('0x6f'),'uri':util[_0xffcc('0x70')](_0xffcc('0x71'),_0xe4a119,_0xffcc('0x72')),'json':!![]};switch(_0x3897b9[_0xffcc('0x6c')]){case _0xffcc('0x6a'):_0x3e65f6[_0xffcc('0x73')]={'Authorization':util[_0xffcc('0x70')]('Basic\x20%s',new Buffer(util[_0xffcc('0x70')](_0xffcc('0x74'),_0x3897b9[_0xffcc('0x69')],_0x3897b9['password']))[_0xffcc('0x75')](_0xffcc('0x76')))};break;case'token':_0x3e65f6[_0xffcc('0x73')]={'Authorization':util[_0xffcc('0x70')](_0xffcc('0x77'),new Buffer(util[_0xffcc('0x70')](_0xffcc('0x78'),_0x3897b9['username'],_0x3897b9[_0xffcc('0x6b')]))['toString'](_0xffcc('0x76')))};break;default:throw new db['Sequelize'][(_0xffcc('0x1f'))](_0xffcc('0x79'));}return rp(_0x3e65f6);}})[_0xffcc('0x36')](function(_0x38ef89){if(_0x38ef89){var _0x433151=['subject',_0xffcc('0x7a'),_0xffcc('0x7b'),'assignee'];_['remove'](_0x38ef89[_0xffcc('0x72')],function(_0x30aba6){return _0x433151[_0xffcc('0x7c')](_0x30aba6[_0xffcc('0x3f')]);});return{'count':_0x38ef89[_0xffcc('0x72')][_0xffcc('0x54')],'rows':_[_0xffcc('0x3b')](_0x38ef89[_0xffcc('0x72')],function(_0x11e7ce){return{'id':_0x11e7ce['id'],'name':_0x11e7ce[_0xffcc('0x7d')]>0x7?_0x11e7ce['title']:_0x11e7ce[_0xffcc('0x3f')],'custom':_0x11e7ce[_0xffcc('0x7d')]>0x7?!![]:![],'options':_0x11e7ce[_0xffcc('0x7e')]?_0x11e7ce[_0xffcc('0x7e')]:_0x11e7ce[_0xffcc('0x7f')]?_0x11e7ce[_0xffcc('0x7f')]:[]};})};}})[_0xffcc('0x36')](respondWithResult(_0x4129de,null))[_0xffcc('0x2b')](function(_0x1196c9){var _0x3db0b6=_0x4f0ae1['query'][_0xffcc('0x1e')]?0x1f4:_0x1196c9[_0xffcc('0x80')]||0x1f4;logger[_0xffcc('0x27')](_0xffcc('0x81'),_0xffcc('0x68'),_0x3db0b6,JSON['stringify'](_0x1196c9));delete _0x1196c9['name'];if(_0x3db0b6===0x191){_0x3db0b6=0x190;}_0x4129de[_0xffcc('0x2d')](_0x3db0b6)[_0xffcc('0x39')](_0x4f0ae1[_0xffcc('0x42')][_0xffcc('0x1e')]?{'message':_0xffcc('0x82'),'statusCode':_0x1196c9['statusCode']}:_0x1196c9);});};
\ No newline at end of file
+var _0x915a=['result','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','ZendeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','ZendeskConfiguration','map','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','authType','remoteUri','slice','substring','GET','Basic\x20%s','format','%s:%s','base64','token','headers','%s/token:%s','toString','Sequelize','ValidationError','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x130990,_0x38a2b1){var _0x111fe8=function(_0x8608d4){while(--_0x8608d4){_0x130990['push'](_0x130990['shift']());}};_0x111fe8(++_0x38a2b1);}(_0x915a,0x1d2));var _0xa915=function(_0x755111,_0x1926a0){_0x755111=_0x755111-0x0;var _0x4bd1ff=_0x915a[_0x755111];return _0x4bd1ff;};'use strict';var pdf=require(_0xa915('0x0'));var emlformat=require(_0xa915('0x1'));var rimraf=require(_0xa915('0x2'));var zipdir=require(_0xa915('0x3'));var jsonpatch=require(_0xa915('0x4'));var rp=require('request-promise');var moment=require(_0xa915('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa915('0x6'));var path=require(_0xa915('0x7'));var sox=require(_0xa915('0x8'));var csv=require(_0xa915('0x9'));var ejs=require(_0xa915('0xa'));var fs=require('fs');var _=require(_0xa915('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa915('0xc'));var deskjs=require(_0xa915('0xd'));var toCsv=require(_0xa915('0x9'));var querystring=require(_0xa915('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa915('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa915('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa915('0x11'))(_0xa915('0x12'));var utils=require(_0xa915('0x13'));var config=require(_0xa915('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xa915('0x15'));var jayson=require('jayson/promise');var client=jayson[_0xa915('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb897e2,_0x3aae6f,_0x22b588,_0x21d782){return new BPromise(function(_0x3ecf23,_0x229a83){var _0x4c3f35=_0x21d782||client;return _0x4c3f35[_0xa915('0x17')](_0xb897e2,_0x22b588)[_0xa915('0x18')](function(_0xf9f02c){logger['info'](_0xa915('0x19'),_0x3aae6f,_0xa915('0x1a'));logger[_0xa915('0x1b')](_0xa915('0x1c'),_0x3aae6f,_0xa915('0x1a'),JSON[_0xa915('0x1d')](_0xf9f02c));if(_0xf9f02c[_0xa915('0x1e')]){if(_0xf9f02c[_0xa915('0x1e')][_0xa915('0x1f')]===0x1f4){logger[_0xa915('0x1e')](_0xa915('0x19'),_0x3aae6f,_0xf9f02c['error'][_0xa915('0x20')]);return _0x229a83(_0xf9f02c['error'][_0xa915('0x20')]);}logger[_0xa915('0x1e')](_0xa915('0x19'),_0x3aae6f,_0xf9f02c[_0xa915('0x1e')][_0xa915('0x20')]);return _0x3ecf23(_0xf9f02c['error'][_0xa915('0x20')]);}else{logger[_0xa915('0x21')](_0xa915('0x19'),_0x3aae6f,_0xa915('0x1a'));_0x3ecf23(_0xf9f02c[_0xa915('0x22')][_0xa915('0x20')]);}})['catch'](function(_0x401207){logger[_0xa915('0x1e')](_0xa915('0x19'),_0x3aae6f,_0x401207);_0x229a83(_0x401207);});});}function respondWithStatusCode(_0x23515d,_0x5a3eac){_0x5a3eac=_0x5a3eac||0xcc;return function(_0x52471d){if(_0x52471d){return _0x23515d[_0xa915('0x23')](_0x5a3eac);}return _0x23515d['status'](_0x5a3eac)[_0xa915('0x24')]();};}function respondWithResult(_0x3b8cbb,_0x3898cc){_0x3898cc=_0x3898cc||0xc8;return function(_0x462b94){if(_0x462b94){return _0x3b8cbb[_0xa915('0x25')](_0x3898cc)[_0xa915('0x26')](_0x462b94);}};}function respondWithFilteredResult(_0x116246,_0x525f55){return function(_0x152d6e){if(_0x152d6e){var _0x1bb9e4=_0x152d6e[_0xa915('0x27')],_0x5cd3f2=_0x525f55[_0xa915('0x28')],_0x1bee59=_0x525f55['offset']+_0x525f55[_0xa915('0x29')],_0x1645d5;if(_0x1bee59>=_0x1bb9e4){_0x1bee59=_0x1bb9e4;_0x1645d5=0xc8;}else{_0x1645d5=0xce;}_0x116246[_0xa915('0x25')](_0x1645d5);return _0x116246['set'](_0xa915('0x2a'),_0x5cd3f2+'-'+_0x1bee59+'/'+_0x1bb9e4)[_0xa915('0x26')](_0x152d6e);}return null;};}function patchUpdates(_0x13aea0){return function(_0x2f847e){try{jsonpatch[_0xa915('0x2b')](_0x2f847e,_0x13aea0,!![]);}catch(_0x1a0276){return BPromise['reject'](_0x1a0276);}return _0x2f847e[_0xa915('0x2c')]();};}function saveUpdates(_0x319238,_0x119d36){return function(_0x501bf1){if(_0x501bf1){return _0x501bf1[_0xa915('0x2d')](_0x319238)[_0xa915('0x18')](function(_0x430fa6){return _0x430fa6;});}return null;};}function removeEntity(_0x4a367d,_0x3e20c8){return function(_0x39482f){if(_0x39482f){return _0x39482f[_0xa915('0x2e')]()[_0xa915('0x18')](function(){_0x4a367d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cf0f0,_0x3dc789){return function(_0x267b3f){if(!_0x267b3f){_0x2cf0f0['sendStatus'](0x194);}return _0x267b3f;};}function handleError(_0xe82283,_0x4fcb1c){_0x4fcb1c=_0x4fcb1c||0x1f4;return function(_0x680b13){logger[_0xa915('0x1e')](_0x680b13[_0xa915('0x2f')]);if(_0x680b13[_0xa915('0x30')]){delete _0x680b13[_0xa915('0x30')];}_0xe82283[_0xa915('0x25')](_0x4fcb1c)[_0xa915('0x31')](_0x680b13);};}exports['index']=function(_0x252643,_0x3ab97d){var _0x42a0f7={},_0x10edbf={},_0x67cec1={'count':0x0,'rows':[]};var _0x3bc4d0=_['map'](db[_0xa915('0x32')][_0xa915('0x33')],function(_0xb327ce){return{'name':_0xb327ce[_0xa915('0x34')],'type':_0xb327ce[_0xa915('0x35')][_0xa915('0x36')]};});_0x10edbf[_0xa915('0x37')]=_['map'](_0x3bc4d0,'name');_0x10edbf['query']=_[_0xa915('0x38')](_0x252643[_0xa915('0x39')]);_0x10edbf[_0xa915('0x3a')]=_[_0xa915('0x3b')](_0x10edbf[_0xa915('0x37')],_0x10edbf[_0xa915('0x39')]);_0x42a0f7[_0xa915('0x3c')]=_[_0xa915('0x3b')](_0x10edbf[_0xa915('0x37')],qs[_0xa915('0x3d')](_0x252643[_0xa915('0x39')][_0xa915('0x3d')]));_0x42a0f7[_0xa915('0x3c')]=_0x42a0f7[_0xa915('0x3c')][_0xa915('0x3e')]?_0x42a0f7['attributes']:_0x10edbf[_0xa915('0x37')];if(!_0x252643[_0xa915('0x39')][_0xa915('0x3f')](_0xa915('0x40'))){_0x42a0f7[_0xa915('0x29')]=qs['limit'](_0x252643[_0xa915('0x39')][_0xa915('0x29')]);_0x42a0f7[_0xa915('0x28')]=qs[_0xa915('0x28')](_0x252643['query'][_0xa915('0x28')]);}_0x42a0f7[_0xa915('0x41')]=qs[_0xa915('0x42')](_0x252643[_0xa915('0x39')][_0xa915('0x42')]);_0x42a0f7[_0xa915('0x43')]=qs[_0xa915('0x3a')](_[_0xa915('0x44')](_0x252643['query'],_0x10edbf[_0xa915('0x3a')]),_0x3bc4d0);if(_0x252643[_0xa915('0x39')][_0xa915('0x45')]){_0x42a0f7[_0xa915('0x43')]=_['merge'](_0x42a0f7[_0xa915('0x43')],{'$or':_['map'](_0x3bc4d0,function(_0x41606e){if(_0x41606e[_0xa915('0x35')]!=='VIRTUAL'){var _0x1d266c={};_0x1d266c[_0x41606e['name']]={'$like':'%'+_0x252643['query'][_0xa915('0x45')]+'%'};return _0x1d266c;}})});}_0x42a0f7=_[_0xa915('0x46')]({},_0x42a0f7,_0x252643[_0xa915('0x47')]);var _0x1c2293={'where':_0x42a0f7[_0xa915('0x43')]};return db[_0xa915('0x32')]['count'](_0x1c2293)[_0xa915('0x18')](function(_0x6cc2c5){_0x67cec1[_0xa915('0x27')]=_0x6cc2c5;if(_0x252643[_0xa915('0x39')][_0xa915('0x48')]){_0x42a0f7[_0xa915('0x49')]=[{'all':!![]}];}return db[_0xa915('0x32')][_0xa915('0x4a')](_0x42a0f7);})['then'](function(_0x4e2df0){_0x67cec1[_0xa915('0x4b')]=_0x4e2df0;return _0x67cec1;})[_0xa915('0x18')](respondWithFilteredResult(_0x3ab97d,_0x42a0f7))[_0xa915('0x4c')](handleError(_0x3ab97d,null));};exports[_0xa915('0x4d')]=function(_0x19bb91,_0x22b82d){var _0x4cba1e={'raw':![],'where':{'id':_0x19bb91[_0xa915('0x4e')]['id']}},_0x263c4a={};_0x263c4a[_0xa915('0x37')]=_[_0xa915('0x38')](db[_0xa915('0x32')][_0xa915('0x33')]);_0x263c4a[_0xa915('0x39')]=_[_0xa915('0x38')](_0x19bb91['query']);_0x263c4a[_0xa915('0x3a')]=_[_0xa915('0x3b')](_0x263c4a[_0xa915('0x37')],_0x263c4a[_0xa915('0x39')]);_0x4cba1e[_0xa915('0x3c')]=_[_0xa915('0x3b')](_0x263c4a[_0xa915('0x37')],qs[_0xa915('0x3d')](_0x19bb91[_0xa915('0x39')][_0xa915('0x3d')]));_0x4cba1e['attributes']=_0x4cba1e['attributes']['length']?_0x4cba1e[_0xa915('0x3c')]:_0x263c4a[_0xa915('0x37')];if(_0x19bb91[_0xa915('0x39')][_0xa915('0x48')]){_0x4cba1e['include']=[{'all':!![]}];}_0x4cba1e=_[_0xa915('0x46')]({},_0x4cba1e,_0x19bb91[_0xa915('0x47')]);return db[_0xa915('0x32')][_0xa915('0x4f')](_0x4cba1e)[_0xa915('0x18')](handleEntityNotFound(_0x22b82d,null))[_0xa915('0x18')](respondWithResult(_0x22b82d,null))[_0xa915('0x4c')](handleError(_0x22b82d,null));};exports['create']=function(_0x43b5b9,_0xf156df){return db[_0xa915('0x32')][_0xa915('0x50')](_0x43b5b9[_0xa915('0x51')],{})['then'](respondWithResult(_0xf156df,0xc9))[_0xa915('0x4c')](handleError(_0xf156df,null));};exports['update']=function(_0x5a2362,_0x4c6f0d){if(_0x5a2362[_0xa915('0x51')]['id']){delete _0x5a2362[_0xa915('0x51')]['id'];}return db[_0xa915('0x32')][_0xa915('0x4f')]({'where':{'id':_0x5a2362['params']['id']}})[_0xa915('0x18')](handleEntityNotFound(_0x4c6f0d,null))[_0xa915('0x18')](saveUpdates(_0x5a2362[_0xa915('0x51')],null))[_0xa915('0x18')](respondWithResult(_0x4c6f0d,null))[_0xa915('0x4c')](handleError(_0x4c6f0d,null));};exports[_0xa915('0x2e')]=function(_0x1286e7,_0x459500){return db[_0xa915('0x32')][_0xa915('0x4f')]({'where':{'id':_0x1286e7[_0xa915('0x4e')]['id']}})['then'](handleEntityNotFound(_0x459500,null))[_0xa915('0x18')](removeEntity(_0x459500,null))[_0xa915('0x4c')](handleError(_0x459500,null));};exports[_0xa915('0x52')]=function(_0x3f281c,_0x2efa4d,_0x34cc2b){var _0x29cb0d={};var _0x534d20={};var _0x4fe0d8;var _0x2d8031;return db[_0xa915('0x32')]['findOne']({'where':{'id':_0x3f281c[_0xa915('0x4e')]['id']}})[_0xa915('0x18')](handleEntityNotFound(_0x2efa4d,null))['then'](function(_0x3370e4){if(_0x3370e4){_0x4fe0d8=_0x3370e4;_0x534d20[_0xa915('0x37')]=_['keys'](db[_0xa915('0x53')][_0xa915('0x33')]);_0x534d20['query']=_[_0xa915('0x38')](_0x3f281c[_0xa915('0x39')]);_0x534d20[_0xa915('0x3a')]=_[_0xa915('0x3b')](_0x534d20['model'],_0x534d20['query']);_0x29cb0d[_0xa915('0x3c')]=_[_0xa915('0x3b')](_0x534d20[_0xa915('0x37')],qs[_0xa915('0x3d')](_0x3f281c[_0xa915('0x39')][_0xa915('0x3d')]));_0x29cb0d[_0xa915('0x3c')]=_0x29cb0d[_0xa915('0x3c')]['length']?_0x29cb0d[_0xa915('0x3c')]:_0x534d20[_0xa915('0x37')];_0x29cb0d[_0xa915('0x41')]=qs[_0xa915('0x42')](_0x3f281c[_0xa915('0x39')][_0xa915('0x42')]);_0x29cb0d[_0xa915('0x43')]=qs[_0xa915('0x3a')](_[_0xa915('0x44')](_0x3f281c['query'],_0x534d20[_0xa915('0x3a')]));if(_0x3f281c[_0xa915('0x39')][_0xa915('0x45')]){_0x29cb0d[_0xa915('0x43')]=_['merge'](_0x29cb0d[_0xa915('0x43')],{'$or':_[_0xa915('0x54')](_0x29cb0d[_0xa915('0x3c')],function(_0x104e1f){var _0x451cf9={};_0x451cf9[_0x104e1f]={'$like':'%'+_0x3f281c[_0xa915('0x39')]['filter']+'%'};return _0x451cf9;})});}_0x29cb0d=_[_0xa915('0x46')]({},_0x29cb0d,_0x3f281c['options']);return _0x4fe0d8[_0xa915('0x52')](_0x29cb0d);}})[_0xa915('0x18')](function(_0x362204){if(_0x362204){_0x2d8031=_0x362204[_0xa915('0x3e')];if(!_0x3f281c[_0xa915('0x39')][_0xa915('0x3f')](_0xa915('0x40'))){_0x29cb0d[_0xa915('0x29')]=qs['limit'](_0x3f281c[_0xa915('0x39')][_0xa915('0x29')]);_0x29cb0d['offset']=qs[_0xa915('0x28')](_0x3f281c[_0xa915('0x39')][_0xa915('0x28')]);}return _0x4fe0d8[_0xa915('0x52')](_0x29cb0d);}})[_0xa915('0x18')](function(_0x28f724){if(_0x28f724){return _0x28f724?{'count':_0x2d8031,'rows':_0x28f724}:null;}})[_0xa915('0x18')](respondWithResult(_0x2efa4d,null))[_0xa915('0x4c')](handleError(_0x2efa4d,null));};exports[_0xa915('0x55')]=function(_0x5c69fe,_0x4fa2e6,_0x1add21){if(_0x5c69fe['body']['id']){delete _0x5c69fe['body']['id'];}return db[_0xa915('0x32')][_0xa915('0x56')]({'where':{'id':_0x5c69fe[_0xa915('0x4e')]['id']}})[_0xa915('0x18')](handleEntityNotFound(_0x4fa2e6,null))[_0xa915('0x18')](function(_0x427890){if(_0x427890){_0x5c69fe[_0xa915('0x51')][_0xa915('0x57')]=_0x427890['id'];_0x5c69fe[_0xa915('0x51')][_0xa915('0x58')]=integrations[_0xa915('0x59')](_0x5c69fe['body'][_0xa915('0x5a')],_0x5c69fe[_0xa915('0x51')][_0xa915('0x35')]);_0x5c69fe['body'][_0xa915('0x5b')]=integrations[_0xa915('0x5c')](_0x5c69fe[_0xa915('0x51')][_0xa915('0x5a')],_0x5c69fe[_0xa915('0x51')]['type']);return db[_0xa915('0x53')][_0xa915('0x50')](_0x5c69fe['body'],{'include':[{'model':db[_0xa915('0x5d')],'as':'Subjects'},{'model':db[_0xa915('0x5d')],'as':_0xa915('0x5b')}]});}return null;})[_0xa915('0x18')](respondWithResult(_0x4fa2e6,null))[_0xa915('0x4c')](handleError(_0x4fa2e6,null));};exports[_0xa915('0x5e')]=function(_0x3104f7,_0x2c9553,_0x317887){var _0x80a555='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x3104f7[_0xa915('0x4e')]['id']},'attributes':['id',_0xa915('0x5f'),_0xa915('0x60'),'token',_0xa915('0x61'),_0xa915('0x62')]})[_0xa915('0x18')](handleEntityNotFound(_0x2c9553,null))[_0xa915('0x18')](function(_0x5d8d44){if(_0x5d8d44){_0x80a555=_0x5d8d44[_0xa915('0x62')];var _0x518263=_0x80a555[_0xa915('0x63')](-0x1);if(_0x518263==='/'){_0x80a555=_0x80a555[_0xa915('0x64')](0x0,_0x80a555['lastIndexOf'](_0x518263));}var _0x398f4c={'method':_0xa915('0x65'),'uri':util['format']('%s/%s',_0x80a555,'ticket_fields'),'json':!![]};switch(_0x5d8d44[_0xa915('0x61')]){case _0xa915('0x60'):_0x398f4c['headers']={'Authorization':util['format'](_0xa915('0x66'),new Buffer(util[_0xa915('0x67')](_0xa915('0x68'),_0x5d8d44[_0xa915('0x5f')],_0x5d8d44[_0xa915('0x60')]))['toString'](_0xa915('0x69')))};break;case _0xa915('0x6a'):_0x398f4c[_0xa915('0x6b')]={'Authorization':util[_0xa915('0x67')]('Basic\x20%s',new Buffer(util['format'](_0xa915('0x6c'),_0x5d8d44[_0xa915('0x5f')],_0x5d8d44[_0xa915('0x6a')]))[_0xa915('0x6d')](_0xa915('0x69')))};break;default:throw new db[(_0xa915('0x6e'))][(_0xa915('0x6f'))]('Unknown\x20authentication\x20type');}return rp(_0x398f4c);}})[_0xa915('0x18')](function(_0x578915){if(_0x578915){var _0x31099f=[_0xa915('0x70'),_0xa915('0x71'),'group',_0xa915('0x72')];_[_0xa915('0x73')](_0x578915[_0xa915('0x74')],function(_0x113717){return _0x31099f[_0xa915('0x75')](_0x113717[_0xa915('0x35')]);});return{'count':_0x578915[_0xa915('0x74')][_0xa915('0x3e')],'rows':_[_0xa915('0x54')](_0x578915['ticket_fields'],function(_0x1cc72f){return{'id':_0x1cc72f['id'],'name':_0x1cc72f[_0xa915('0x76')]>0x7?_0x1cc72f[_0xa915('0x77')]:_0x1cc72f['type'],'custom':_0x1cc72f[_0xa915('0x76')]>0x7?!![]:![],'options':_0x1cc72f[_0xa915('0x78')]?_0x1cc72f['system_field_options']:_0x1cc72f[_0xa915('0x79')]?_0x1cc72f['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x2c9553,null))[_0xa915('0x4c')](function(_0x3b0e9e){var _0x2b6d51=_0x3104f7['query'][_0xa915('0x7a')]?0x1f4:_0x3b0e9e[_0xa915('0x7b')]||0x1f4;logger[_0xa915('0x1e')]('getFields,\x20%s,\x20%s,\x20%s',_0xa915('0x5e'),_0x2b6d51,JSON[_0xa915('0x1d')](_0x3b0e9e));delete _0x3b0e9e[_0xa915('0x30')];if(_0x2b6d51===0x191){_0x2b6d51=0x190;}_0x2c9553[_0xa915('0x25')](_0x2b6d51)[_0xa915('0x31')](_0x3104f7[_0xa915('0x39')][_0xa915('0x7a')]?{'message':_0xa915('0x7c'),'statusCode':_0x3b0e9e[_0xa915('0x7b')]}:_0x3b0e9e);});};
\ No newline at end of file