Built motion from commit 616d3211.|2.6.4
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index 0f23173..394bcff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f8b=['order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','filters','length','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x5f8b,0x160));var _0xb5f8=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x5f8b[_0x1a72f3];return _0x57ef47;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5f8('0x0'));var zipdir=require(_0xb5f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb5f8('0x2'));var Mustache=require(_0xb5f8('0x3'));var util=require('util');var path=require(_0xb5f8('0x4'));var sox=require(_0xb5f8('0x5'));var csv=require('to-csv');var ejs=require(_0xb5f8('0x6'));var fs=require('fs');var fs_extra=require(_0xb5f8('0x7'));var _=require(_0xb5f8('0x8'));var squel=require(_0xb5f8('0x9'));var crypto=require('crypto');var jsforce=require(_0xb5f8('0xa'));var deskjs=require(_0xb5f8('0xb'));var toCsv=require(_0xb5f8('0xc'));var querystring=require('querystring');var Papa=require(_0xb5f8('0xd'));var Redis=require(_0xb5f8('0xe'));var authService=require(_0xb5f8('0xf'));var qs=require(_0xb5f8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5f8('0x11'));var logger=require(_0xb5f8('0x12'))('api');var utils=require(_0xb5f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb5f8('0x14'));var db=require(_0xb5f8('0x15'))['db'];function respondWithStatusCode(_0x3a178e,_0xfed86c){_0xfed86c=_0xfed86c||0xcc;return function(_0x542a47){if(_0x542a47){return _0x3a178e[_0xb5f8('0x16')](_0xfed86c);}return _0x3a178e['status'](_0xfed86c)[_0xb5f8('0x17')]();};}function respondWithResult(_0xfaa91f,_0x237304){_0x237304=_0x237304||0xc8;return function(_0x80b682){if(_0x80b682){return _0xfaa91f['status'](_0x237304)[_0xb5f8('0x18')](_0x80b682);}};}function respondWithFilteredResult(_0x2770e0,_0x2f9efe){return function(_0x200408){if(_0x200408){var _0x48bfe0=typeof _0x2f9efe[_0xb5f8('0x19')]===_0xb5f8('0x1a')&&typeof _0x2f9efe[_0xb5f8('0x1b')]==='undefined';var _0x4947d0=_0x200408[_0xb5f8('0x1c')];var _0x352a38=_0x48bfe0?0x0:_0x2f9efe[_0xb5f8('0x19')];var _0x17b2df=_0x48bfe0?_0x200408[_0xb5f8('0x1c')]:_0x2f9efe[_0xb5f8('0x19')]+_0x2f9efe[_0xb5f8('0x1b')];var _0x465ec4;if(_0x17b2df>=_0x4947d0){_0x17b2df=_0x4947d0;_0x465ec4=0xc8;}else{_0x465ec4=0xce;}_0x2770e0[_0xb5f8('0x1d')](_0x465ec4);return _0x2770e0[_0xb5f8('0x1e')](_0xb5f8('0x1f'),_0x352a38+'-'+_0x17b2df+'/'+_0x4947d0)['json'](_0x200408);}return null;};}function patchUpdates(_0x133f38){return function(_0x87141b){try{jsonpatch[_0xb5f8('0x20')](_0x87141b,_0x133f38,!![]);}catch(_0x44cc9f){return BPromise[_0xb5f8('0x21')](_0x44cc9f);}return _0x87141b[_0xb5f8('0x22')]();};}function saveUpdates(_0xca4f7f,_0x22beb9){return function(_0x383a60){if(_0x383a60){return _0x383a60[_0xb5f8('0x23')](_0xca4f7f)['then'](function(_0x379277){return _0x379277;});}return null;};}function removeEntity(_0x56fb4c,_0x16cb54){return function(_0x53e913){if(_0x53e913){return _0x53e913['destroy']()[_0xb5f8('0x24')](function(){_0x56fb4c[_0xb5f8('0x1d')](0xcc)[_0xb5f8('0x17')]();});}};}function handleEntityNotFound(_0x4bc5db,_0x117638){return function(_0x7af1fc){if(!_0x7af1fc){_0x4bc5db['sendStatus'](0x194);}return _0x7af1fc;};}function handleError(_0x3aeb57,_0xec7bf5){_0xec7bf5=_0xec7bf5||0x1f4;return function(_0x4de14d){logger[_0xb5f8('0x25')](_0x4de14d[_0xb5f8('0x26')]);if(_0x4de14d['name']){delete _0x4de14d[_0xb5f8('0x27')];}_0x3aeb57[_0xb5f8('0x1d')](_0xec7bf5)['send'](_0x4de14d);};}exports['index']=function(_0x5edfcc,_0x3eaf37){var _0x1ae82d={},_0xf8bf21={},_0x8cccb6={'count':0x0,'rows':[]};var _0x4fa3d1=_[_0xb5f8('0x28')](db[_0xb5f8('0x29')][_0xb5f8('0x2a')],function(_0x27907b){return{'name':_0x27907b[_0xb5f8('0x2b')],'type':_0x27907b[_0xb5f8('0x2c')]['key']};});_0xf8bf21[_0xb5f8('0x2d')]=_['map'](_0x4fa3d1,'name');_0xf8bf21[_0xb5f8('0x2e')]=_[_0xb5f8('0x2f')](_0x5edfcc[_0xb5f8('0x2e')]);_0xf8bf21['filters']=_[_0xb5f8('0x30')](_0xf8bf21[_0xb5f8('0x2d')],_0xf8bf21['query']);_0x1ae82d[_0xb5f8('0x31')]=_[_0xb5f8('0x30')](_0xf8bf21[_0xb5f8('0x2d')],qs[_0xb5f8('0x32')](_0x5edfcc[_0xb5f8('0x2e')][_0xb5f8('0x32')]));_0x1ae82d[_0xb5f8('0x31')]=_0x1ae82d[_0xb5f8('0x31')]['length']?_0x1ae82d[_0xb5f8('0x31')]:_0xf8bf21[_0xb5f8('0x2d')];if(!_0x5edfcc[_0xb5f8('0x2e')][_0xb5f8('0x33')](_0xb5f8('0x34'))){_0x1ae82d[_0xb5f8('0x1b')]=qs[_0xb5f8('0x1b')](_0x5edfcc[_0xb5f8('0x2e')][_0xb5f8('0x1b')]);_0x1ae82d[_0xb5f8('0x19')]=qs[_0xb5f8('0x19')](_0x5edfcc[_0xb5f8('0x2e')][_0xb5f8('0x19')]);}_0x1ae82d[_0xb5f8('0x35')]=qs[_0xb5f8('0x36')](_0x5edfcc['query'][_0xb5f8('0x36')]);_0x1ae82d['where']=qs['filters'](_[_0xb5f8('0x37')](_0x5edfcc[_0xb5f8('0x2e')],_0xf8bf21['filters']),_0x4fa3d1);if(_0x5edfcc[_0xb5f8('0x2e')]['filter']){_0x1ae82d[_0xb5f8('0x38')]=_[_0xb5f8('0x39')](_0x1ae82d['where'],{'$or':_[_0xb5f8('0x28')](_0x4fa3d1,function(_0x372eea){if(_0x372eea[_0xb5f8('0x2c')]!==_0xb5f8('0x3a')){var _0x4fb8a0={};_0x4fb8a0[_0x372eea['name']]={'$like':'%'+_0x5edfcc[_0xb5f8('0x2e')][_0xb5f8('0x3b')]+'%'};return _0x4fb8a0;}})});}_0x1ae82d=_[_0xb5f8('0x39')]({},_0x1ae82d,_0x5edfcc[_0xb5f8('0x3c')]);var _0x284bcb={'where':_0x1ae82d[_0xb5f8('0x38')]};return db[_0xb5f8('0x29')][_0xb5f8('0x1c')](_0x284bcb)['then'](function(_0x226e00){_0x8cccb6[_0xb5f8('0x1c')]=_0x226e00;if(_0x5edfcc[_0xb5f8('0x2e')][_0xb5f8('0x3d')]){_0x1ae82d[_0xb5f8('0x3e')]=[{'all':!![]}];}return db[_0xb5f8('0x29')][_0xb5f8('0x3f')](_0x1ae82d);})[_0xb5f8('0x24')](function(_0x31820e){_0x8cccb6['rows']=_0x31820e;return _0x8cccb6;})[_0xb5f8('0x24')](respondWithFilteredResult(_0x3eaf37,_0x1ae82d))[_0xb5f8('0x40')](handleError(_0x3eaf37,null));};exports[_0xb5f8('0x41')]=function(_0x1dcf44,_0x42e1a9){var _0x524a75={'raw':![],'where':{'id':_0x1dcf44[_0xb5f8('0x42')]['id']}},_0x5e11e3={};_0x5e11e3[_0xb5f8('0x2d')]=_['keys'](db[_0xb5f8('0x29')]['rawAttributes']);_0x5e11e3[_0xb5f8('0x2e')]=_[_0xb5f8('0x2f')](_0x1dcf44[_0xb5f8('0x2e')]);_0x5e11e3[_0xb5f8('0x43')]=_[_0xb5f8('0x30')](_0x5e11e3[_0xb5f8('0x2d')],_0x5e11e3[_0xb5f8('0x2e')]);_0x524a75[_0xb5f8('0x31')]=_[_0xb5f8('0x30')](_0x5e11e3[_0xb5f8('0x2d')],qs[_0xb5f8('0x32')](_0x1dcf44[_0xb5f8('0x2e')][_0xb5f8('0x32')]));_0x524a75[_0xb5f8('0x31')]=_0x524a75['attributes'][_0xb5f8('0x44')]?_0x524a75[_0xb5f8('0x31')]:_0x5e11e3['model'];if(_0x1dcf44[_0xb5f8('0x2e')]['includeAll']){_0x524a75[_0xb5f8('0x3e')]=[{'all':!![]}];}_0x524a75=_['merge']({},_0x524a75,_0x1dcf44[_0xb5f8('0x3c')]);return db[_0xb5f8('0x29')][_0xb5f8('0x45')](_0x524a75)['then'](handleEntityNotFound(_0x42e1a9,null))[_0xb5f8('0x24')](respondWithResult(_0x42e1a9,null))[_0xb5f8('0x40')](handleError(_0x42e1a9,null));};exports['create']=function(_0x18f348,_0x10fb91){return db[_0xb5f8('0x29')][_0xb5f8('0x46')](_0x18f348['body'],{})[_0xb5f8('0x24')](respondWithResult(_0x10fb91,0xc9))[_0xb5f8('0x40')](handleError(_0x10fb91,null));};exports[_0xb5f8('0x23')]=function(_0x4ad86e,_0x5a70cb){if(_0x4ad86e[_0xb5f8('0x47')]['id']){delete _0x4ad86e['body']['id'];}return db[_0xb5f8('0x29')]['find']({'where':{'id':_0x4ad86e[_0xb5f8('0x42')]['id']}})[_0xb5f8('0x24')](handleEntityNotFound(_0x5a70cb,null))[_0xb5f8('0x24')](saveUpdates(_0x4ad86e[_0xb5f8('0x47')],null))['then'](respondWithResult(_0x5a70cb,null))[_0xb5f8('0x40')](handleError(_0x5a70cb,null));};exports[_0xb5f8('0x48')]=function(_0x5cc75f,_0x321d42){return db[_0xb5f8('0x29')][_0xb5f8('0x45')]({'where':{'id':_0x5cc75f[_0xb5f8('0x42')]['id']}})['then'](handleEntityNotFound(_0x321d42,null))[_0xb5f8('0x24')](removeEntity(_0x321d42,null))['catch'](handleError(_0x321d42,null));};exports[_0xb5f8('0x49')]=function(_0x335eaf,_0x228924,_0x3c0318){var _0x2caab6={};var _0x463aad={};var _0x126150;var _0x3dbcec;return db[_0xb5f8('0x29')][_0xb5f8('0x4a')]({'where':{'id':_0x335eaf[_0xb5f8('0x42')]['id']}})['then'](handleEntityNotFound(_0x228924,null))[_0xb5f8('0x24')](function(_0x24d2e0){if(_0x24d2e0){_0x126150=_0x24d2e0;_0x463aad[_0xb5f8('0x2d')]=_['keys'](db[_0xb5f8('0x4b')]['rawAttributes']);_0x463aad[_0xb5f8('0x2e')]=_[_0xb5f8('0x2f')](_0x335eaf[_0xb5f8('0x2e')]);_0x463aad[_0xb5f8('0x43')]=_[_0xb5f8('0x30')](_0x463aad[_0xb5f8('0x2d')],_0x463aad[_0xb5f8('0x2e')]);_0x2caab6[_0xb5f8('0x31')]=_['intersection'](_0x463aad[_0xb5f8('0x2d')],qs[_0xb5f8('0x32')](_0x335eaf[_0xb5f8('0x2e')][_0xb5f8('0x32')]));_0x2caab6[_0xb5f8('0x31')]=_0x2caab6['attributes'][_0xb5f8('0x44')]?_0x2caab6['attributes']:_0x463aad[_0xb5f8('0x2d')];_0x2caab6[_0xb5f8('0x35')]=qs[_0xb5f8('0x36')](_0x335eaf[_0xb5f8('0x2e')][_0xb5f8('0x36')]);_0x2caab6[_0xb5f8('0x38')]=qs[_0xb5f8('0x43')](_[_0xb5f8('0x37')](_0x335eaf[_0xb5f8('0x2e')],_0x463aad[_0xb5f8('0x43')]));if(_0x335eaf[_0xb5f8('0x2e')][_0xb5f8('0x3b')]){_0x2caab6[_0xb5f8('0x38')]=_[_0xb5f8('0x39')](_0x2caab6[_0xb5f8('0x38')],{'$or':_[_0xb5f8('0x28')](_0x2caab6[_0xb5f8('0x31')],function(_0x28e9e7){var _0xbd1faf={};_0xbd1faf[_0x28e9e7]={'$like':'%'+_0x335eaf[_0xb5f8('0x2e')][_0xb5f8('0x3b')]+'%'};return _0xbd1faf;})});}_0x2caab6=_[_0xb5f8('0x39')]({},_0x2caab6,_0x335eaf[_0xb5f8('0x3c')]);return _0x126150[_0xb5f8('0x49')](_0x2caab6);}})['then'](function(_0x40c0f2){if(_0x40c0f2){_0x3dbcec=_0x40c0f2[_0xb5f8('0x44')];if(!_0x335eaf[_0xb5f8('0x2e')][_0xb5f8('0x33')](_0xb5f8('0x34'))){_0x2caab6['limit']=qs[_0xb5f8('0x1b')](_0x335eaf[_0xb5f8('0x2e')][_0xb5f8('0x1b')]);_0x2caab6[_0xb5f8('0x19')]=qs[_0xb5f8('0x19')](_0x335eaf[_0xb5f8('0x2e')]['offset']);}return _0x126150['getFields'](_0x2caab6);}})[_0xb5f8('0x24')](function(_0x1af25a){if(_0x1af25a){return _0x1af25a?{'count':_0x3dbcec,'rows':_0x1af25a}:null;}})['then'](respondWithResult(_0x228924,null))[_0xb5f8('0x40')](handleError(_0x228924,null));};exports['getSubjects']=function(_0x51c1e9,_0xa0b763,_0x42c2b8){var _0x1b91cc={};var _0x5c904d={};var _0x4e7d3c;var _0x5a8e98;return db['ZendeskConfiguration'][_0xb5f8('0x4a')]({'where':{'id':_0x51c1e9[_0xb5f8('0x42')]['id']}})[_0xb5f8('0x24')](handleEntityNotFound(_0xa0b763,null))[_0xb5f8('0x24')](function(_0x1e06b5){if(_0x1e06b5){_0x4e7d3c=_0x1e06b5;_0x5c904d[_0xb5f8('0x2d')]=_['keys'](db[_0xb5f8('0x4b')][_0xb5f8('0x2a')]);_0x5c904d[_0xb5f8('0x2e')]=_[_0xb5f8('0x2f')](_0x51c1e9[_0xb5f8('0x2e')]);_0x5c904d['filters']=_[_0xb5f8('0x30')](_0x5c904d[_0xb5f8('0x2d')],_0x5c904d[_0xb5f8('0x2e')]);_0x1b91cc['attributes']=_[_0xb5f8('0x30')](_0x5c904d['model'],qs[_0xb5f8('0x32')](_0x51c1e9[_0xb5f8('0x2e')][_0xb5f8('0x32')]));_0x1b91cc['attributes']=_0x1b91cc['attributes'][_0xb5f8('0x44')]?_0x1b91cc[_0xb5f8('0x31')]:_0x5c904d[_0xb5f8('0x2d')];_0x1b91cc[_0xb5f8('0x35')]=qs['sort'](_0x51c1e9[_0xb5f8('0x2e')][_0xb5f8('0x36')]);_0x1b91cc[_0xb5f8('0x38')]=qs['filters'](_[_0xb5f8('0x37')](_0x51c1e9[_0xb5f8('0x2e')],_0x5c904d[_0xb5f8('0x43')]));if(_0x51c1e9[_0xb5f8('0x2e')][_0xb5f8('0x3b')]){_0x1b91cc[_0xb5f8('0x38')]=_[_0xb5f8('0x39')](_0x1b91cc[_0xb5f8('0x38')],{'$or':_[_0xb5f8('0x28')](_0x1b91cc[_0xb5f8('0x31')],function(_0x5183e8){var _0x5bc844={};_0x5bc844[_0x5183e8]={'$like':'%'+_0x51c1e9['query'][_0xb5f8('0x3b')]+'%'};return _0x5bc844;})});}_0x1b91cc=_[_0xb5f8('0x39')]({},_0x1b91cc,_0x51c1e9[_0xb5f8('0x3c')]);return _0x4e7d3c[_0xb5f8('0x4c')](_0x1b91cc);}})['then'](function(_0x2fb410){if(_0x2fb410){_0x5a8e98=_0x2fb410[_0xb5f8('0x44')];if(!_0x51c1e9[_0xb5f8('0x2e')][_0xb5f8('0x33')]('nolimit')){_0x1b91cc[_0xb5f8('0x1b')]=qs[_0xb5f8('0x1b')](_0x51c1e9[_0xb5f8('0x2e')][_0xb5f8('0x1b')]);_0x1b91cc[_0xb5f8('0x19')]=qs[_0xb5f8('0x19')](_0x51c1e9['query'][_0xb5f8('0x19')]);}return _0x4e7d3c['getSubjects'](_0x1b91cc);}})[_0xb5f8('0x24')](function(_0x535d36){if(_0x535d36){return _0x535d36?{'count':_0x5a8e98,'rows':_0x535d36}:null;}})['then'](respondWithResult(_0xa0b763,null))[_0xb5f8('0x40')](handleError(_0xa0b763,null));};exports[_0xb5f8('0x4d')]=function(_0x352540,_0x6925f,_0x4312fd){var _0x3b8449={};var _0x92b0d0={};var _0x4ff02b;var _0x357858;return db[_0xb5f8('0x29')][_0xb5f8('0x4a')]({'where':{'id':_0x352540[_0xb5f8('0x42')]['id']}})[_0xb5f8('0x24')](handleEntityNotFound(_0x6925f,null))[_0xb5f8('0x24')](function(_0x15237a){if(_0x15237a){_0x4ff02b=_0x15237a;_0x92b0d0['model']=_['keys'](db[_0xb5f8('0x4b')][_0xb5f8('0x2a')]);_0x92b0d0[_0xb5f8('0x2e')]=_[_0xb5f8('0x2f')](_0x352540[_0xb5f8('0x2e')]);_0x92b0d0[_0xb5f8('0x43')]=_['intersection'](_0x92b0d0['model'],_0x92b0d0['query']);_0x3b8449[_0xb5f8('0x31')]=_[_0xb5f8('0x30')](_0x92b0d0[_0xb5f8('0x2d')],qs[_0xb5f8('0x32')](_0x352540[_0xb5f8('0x2e')][_0xb5f8('0x32')]));_0x3b8449[_0xb5f8('0x31')]=_0x3b8449[_0xb5f8('0x31')][_0xb5f8('0x44')]?_0x3b8449['attributes']:_0x92b0d0[_0xb5f8('0x2d')];_0x3b8449[_0xb5f8('0x35')]=qs['sort'](_0x352540['query']['sort']);_0x3b8449[_0xb5f8('0x38')]=qs[_0xb5f8('0x43')](_[_0xb5f8('0x37')](_0x352540['query'],_0x92b0d0[_0xb5f8('0x43')]));if(_0x352540['query']['filter']){_0x3b8449['where']=_['merge'](_0x3b8449['where'],{'$or':_[_0xb5f8('0x28')](_0x3b8449[_0xb5f8('0x31')],function(_0x469749){var _0x1069c1={};_0x1069c1[_0x469749]={'$like':'%'+_0x352540[_0xb5f8('0x2e')][_0xb5f8('0x3b')]+'%'};return _0x1069c1;})});}_0x3b8449=_['merge']({},_0x3b8449,_0x352540['options']);return _0x4ff02b[_0xb5f8('0x4d')](_0x3b8449);}})[_0xb5f8('0x24')](function(_0xe61766){if(_0xe61766){_0x357858=_0xe61766['length'];if(!_0x352540['query'][_0xb5f8('0x33')](_0xb5f8('0x34'))){_0x3b8449[_0xb5f8('0x1b')]=qs[_0xb5f8('0x1b')](_0x352540[_0xb5f8('0x2e')][_0xb5f8('0x1b')]);_0x3b8449[_0xb5f8('0x19')]=qs[_0xb5f8('0x19')](_0x352540[_0xb5f8('0x2e')]['offset']);}return _0x4ff02b[_0xb5f8('0x4d')](_0x3b8449);}})[_0xb5f8('0x24')](function(_0x5632f4){if(_0x5632f4){return _0x5632f4?{'count':_0x357858,'rows':_0x5632f4}:null;}})[_0xb5f8('0x24')](respondWithResult(_0x6925f,null))[_0xb5f8('0x40')](handleError(_0x6925f,null));};exports[_0xb5f8('0x4e')]=function(_0x1fed81,_0xe567b8,_0x497efa){var _0x115c99={};var _0x33e223={};var _0x533916;var _0x234baf;return db[_0xb5f8('0x29')][_0xb5f8('0x4a')]({'where':{'id':_0x1fed81['params']['id']}})[_0xb5f8('0x24')](handleEntityNotFound(_0xe567b8,null))[_0xb5f8('0x24')](function(_0x18e350){if(_0x18e350){_0x533916=_0x18e350;_0x33e223['model']=_[_0xb5f8('0x2f')](db[_0xb5f8('0x4f')]['rawAttributes']);_0x33e223[_0xb5f8('0x2e')]=_[_0xb5f8('0x2f')](_0x1fed81[_0xb5f8('0x2e')]);_0x33e223[_0xb5f8('0x43')]=_[_0xb5f8('0x30')](_0x33e223[_0xb5f8('0x2d')],_0x33e223['query']);_0x115c99[_0xb5f8('0x31')]=_[_0xb5f8('0x30')](_0x33e223[_0xb5f8('0x2d')],qs[_0xb5f8('0x32')](_0x1fed81[_0xb5f8('0x2e')]['fields']));_0x115c99[_0xb5f8('0x31')]=_0x115c99['attributes'][_0xb5f8('0x44')]?_0x115c99[_0xb5f8('0x31')]:_0x33e223[_0xb5f8('0x2d')];_0x115c99['order']=qs[_0xb5f8('0x36')](_0x1fed81[_0xb5f8('0x2e')][_0xb5f8('0x36')]);_0x115c99[_0xb5f8('0x38')]=qs[_0xb5f8('0x43')](_[_0xb5f8('0x37')](_0x1fed81[_0xb5f8('0x2e')],_0x33e223['filters']));if(_0x1fed81[_0xb5f8('0x2e')]['filter']){_0x115c99[_0xb5f8('0x38')]=_[_0xb5f8('0x39')](_0x115c99[_0xb5f8('0x38')],{'$or':_[_0xb5f8('0x28')](_0x115c99[_0xb5f8('0x31')],function(_0x16b47c){var _0x20eb50={};_0x20eb50[_0x16b47c]={'$like':'%'+_0x1fed81[_0xb5f8('0x2e')][_0xb5f8('0x3b')]+'%'};return _0x20eb50;})});}_0x115c99=_['merge']({},_0x115c99,_0x1fed81['options']);return _0x533916[_0xb5f8('0x4e')](_0x115c99);}})[_0xb5f8('0x24')](function(_0xf231){if(_0xf231){_0x234baf=_0xf231[_0xb5f8('0x44')];if(!_0x1fed81['query'][_0xb5f8('0x33')]('nolimit')){_0x115c99['limit']=qs[_0xb5f8('0x1b')](_0x1fed81[_0xb5f8('0x2e')][_0xb5f8('0x1b')]);_0x115c99[_0xb5f8('0x19')]=qs[_0xb5f8('0x19')](_0x1fed81[_0xb5f8('0x2e')]['offset']);}return _0x533916[_0xb5f8('0x4e')](_0x115c99);}})[_0xb5f8('0x24')](function(_0x2eade7){if(_0x2eade7){return _0x2eade7?{'count':_0x234baf,'rows':_0x2eade7}:null;}})[_0xb5f8('0x24')](respondWithResult(_0xe567b8,null))[_0xb5f8('0x40')](handleError(_0xe567b8,null));};exports[_0xb5f8('0x50')]=function(_0x32c73f,_0x115a22,_0x576355){if(_0x32c73f[_0xb5f8('0x47')]['id']){delete _0x32c73f[_0xb5f8('0x47')]['id'];}return db['ZendeskConfiguration'][_0xb5f8('0x4a')]({'where':{'id':_0x32c73f[_0xb5f8('0x42')]['id']}})[_0xb5f8('0x24')](handleEntityNotFound(_0x115a22,null))[_0xb5f8('0x24')](function(_0x1567b0){if(_0x1567b0){return _0x1567b0[_0xb5f8('0x50')](_0x32c73f[_0xb5f8('0x47')]['ids']||[]);}return null;})[_0xb5f8('0x24')](respondWithResult(_0x115a22,null))[_0xb5f8('0x40')](handleError(_0x115a22,null));};
\ No newline at end of file
+var _0xe47a=['ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','nolimit','sort','pick','filters','filter','merge','where','VIRTUAL','ZendeskConfiguration','includeAll','findAll','rows','catch','show','params','intersection','options','find','create','body','getFields','findOne','ZendeskField','order','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe47a,0x10f));var _0xae47=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe47a[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xae47('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae47('0x1'));var jsonpatch=require(_0xae47('0x2'));var rp=require(_0xae47('0x3'));var moment=require(_0xae47('0x4'));var BPromise=require(_0xae47('0x5'));var Mustache=require(_0xae47('0x6'));var util=require(_0xae47('0x7'));var path=require(_0xae47('0x8'));var sox=require(_0xae47('0x9'));var csv=require('to-csv');var ejs=require(_0xae47('0xa'));var fs=require('fs');var fs_extra=require(_0xae47('0xb'));var _=require(_0xae47('0xc'));var squel=require(_0xae47('0xd'));var crypto=require(_0xae47('0xe'));var jsforce=require(_0xae47('0xf'));var deskjs=require(_0xae47('0x10'));var toCsv=require(_0xae47('0x11'));var querystring=require(_0xae47('0x12'));var Papa=require('papaparse');var Redis=require(_0xae47('0x13'));var authService=require(_0xae47('0x14'));var qs=require(_0xae47('0x15'));var as=require(_0xae47('0x16'));var hardwareService=require(_0xae47('0x17'));var logger=require(_0xae47('0x18'))(_0xae47('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xae47('0x1a'));var db=require(_0xae47('0x1b'))['db'];function respondWithStatusCode(_0x52675d,_0x252078){_0x252078=_0x252078||0xcc;return function(_0x453a5a){if(_0x453a5a){return _0x52675d[_0xae47('0x1c')](_0x252078);}return _0x52675d['status'](_0x252078)[_0xae47('0x1d')]();};}function respondWithResult(_0x2e2002,_0x33cf93){_0x33cf93=_0x33cf93||0xc8;return function(_0x84b8ec){if(_0x84b8ec){return _0x2e2002[_0xae47('0x1e')](_0x33cf93)[_0xae47('0x1f')](_0x84b8ec);}};}function respondWithFilteredResult(_0x2d72e7,_0x35d859){return function(_0x17edae){if(_0x17edae){var _0x32459e=typeof _0x35d859['offset']===_0xae47('0x20')&&typeof _0x35d859[_0xae47('0x21')]===_0xae47('0x20');var _0x1e32bc=_0x17edae['count'];var _0x4b8131=_0x32459e?0x0:_0x35d859['offset'];var _0x2f7727=_0x32459e?_0x17edae[_0xae47('0x22')]:_0x35d859[_0xae47('0x23')]+_0x35d859[_0xae47('0x21')];var _0x13e800;if(_0x2f7727>=_0x1e32bc){_0x2f7727=_0x1e32bc;_0x13e800=0xc8;}else{_0x13e800=0xce;}_0x2d72e7[_0xae47('0x1e')](_0x13e800);return _0x2d72e7[_0xae47('0x24')](_0xae47('0x25'),_0x4b8131+'-'+_0x2f7727+'/'+_0x1e32bc)[_0xae47('0x1f')](_0x17edae);}return null;};}function patchUpdates(_0x40e450){return function(_0x70505c){try{jsonpatch[_0xae47('0x26')](_0x70505c,_0x40e450,!![]);}catch(_0x28af38){return BPromise[_0xae47('0x27')](_0x28af38);}return _0x70505c[_0xae47('0x28')]();};}function saveUpdates(_0x1fa5bd,_0x62e225){return function(_0x5f59c4){if(_0x5f59c4){return _0x5f59c4[_0xae47('0x29')](_0x1fa5bd)[_0xae47('0x2a')](function(_0x2e4dd1){return _0x2e4dd1;});}return null;};}function removeEntity(_0x23d988,_0x4b1a58){return function(_0x189609){if(_0x189609){return _0x189609[_0xae47('0x2b')]()[_0xae47('0x2a')](function(){_0x23d988[_0xae47('0x1e')](0xcc)[_0xae47('0x1d')]();});}};}function handleEntityNotFound(_0x45278b,_0x1869fd){return function(_0x48927c){if(!_0x48927c){_0x45278b['sendStatus'](0x194);}return _0x48927c;};}function handleError(_0x197bb4,_0x50a00c){_0x50a00c=_0x50a00c||0x1f4;return function(_0x169895){logger[_0xae47('0x2c')](_0x169895[_0xae47('0x2d')]);if(_0x169895['name']){delete _0x169895[_0xae47('0x2e')];}_0x197bb4[_0xae47('0x1e')](_0x50a00c)[_0xae47('0x2f')](_0x169895);};}exports[_0xae47('0x30')]=function(_0x5d59d4,_0x298c26){var _0x1acf34={},_0x1e1843={},_0x2f7d42={'count':0x0,'rows':[]};var _0x315dd2=_[_0xae47('0x31')](db['ZendeskConfiguration'][_0xae47('0x32')],function(_0x951c35){return{'name':_0x951c35[_0xae47('0x33')],'type':_0x951c35[_0xae47('0x34')]['key']};});_0x1e1843[_0xae47('0x35')]=_['map'](_0x315dd2,_0xae47('0x2e'));_0x1e1843[_0xae47('0x36')]=_[_0xae47('0x37')](_0x5d59d4[_0xae47('0x36')]);_0x1e1843['filters']=_['intersection'](_0x1e1843['model'],_0x1e1843[_0xae47('0x36')]);_0x1acf34[_0xae47('0x38')]=_['intersection'](_0x1e1843[_0xae47('0x35')],qs['fields'](_0x5d59d4[_0xae47('0x36')][_0xae47('0x39')]));_0x1acf34[_0xae47('0x38')]=_0x1acf34[_0xae47('0x38')][_0xae47('0x3a')]?_0x1acf34[_0xae47('0x38')]:_0x1e1843[_0xae47('0x35')];if(!_0x5d59d4[_0xae47('0x36')]['hasOwnProperty'](_0xae47('0x3b'))){_0x1acf34['limit']=qs[_0xae47('0x21')](_0x5d59d4['query']['limit']);_0x1acf34[_0xae47('0x23')]=qs['offset'](_0x5d59d4['query'][_0xae47('0x23')]);}_0x1acf34['order']=qs[_0xae47('0x3c')](_0x5d59d4[_0xae47('0x36')][_0xae47('0x3c')]);_0x1acf34['where']=qs['filters'](_[_0xae47('0x3d')](_0x5d59d4[_0xae47('0x36')],_0x1e1843[_0xae47('0x3e')]),_0x315dd2);if(_0x5d59d4[_0xae47('0x36')][_0xae47('0x3f')]){_0x1acf34['where']=_[_0xae47('0x40')](_0x1acf34[_0xae47('0x41')],{'$or':_['map'](_0x315dd2,function(_0x39f194){if(_0x39f194['type']!==_0xae47('0x42')){var _0x6721fe={};_0x6721fe[_0x39f194[_0xae47('0x2e')]]={'$like':'%'+_0x5d59d4['query'][_0xae47('0x3f')]+'%'};return _0x6721fe;}})});}_0x1acf34=_[_0xae47('0x40')]({},_0x1acf34,_0x5d59d4['options']);var _0x458576={'where':_0x1acf34[_0xae47('0x41')]};return db[_0xae47('0x43')][_0xae47('0x22')](_0x458576)['then'](function(_0x48bfdf){_0x2f7d42['count']=_0x48bfdf;if(_0x5d59d4[_0xae47('0x36')][_0xae47('0x44')]){_0x1acf34['include']=[{'all':!![]}];}return db[_0xae47('0x43')][_0xae47('0x45')](_0x1acf34);})[_0xae47('0x2a')](function(_0x3fac7e){_0x2f7d42[_0xae47('0x46')]=_0x3fac7e;return _0x2f7d42;})['then'](respondWithFilteredResult(_0x298c26,_0x1acf34))[_0xae47('0x47')](handleError(_0x298c26,null));};exports[_0xae47('0x48')]=function(_0x2f3ae9,_0x4f62b1){var _0x38130f={'raw':![],'where':{'id':_0x2f3ae9[_0xae47('0x49')]['id']}},_0x111b8c={};_0x111b8c[_0xae47('0x35')]=_[_0xae47('0x37')](db[_0xae47('0x43')][_0xae47('0x32')]);_0x111b8c['query']=_[_0xae47('0x37')](_0x2f3ae9[_0xae47('0x36')]);_0x111b8c[_0xae47('0x3e')]=_[_0xae47('0x4a')](_0x111b8c[_0xae47('0x35')],_0x111b8c[_0xae47('0x36')]);_0x38130f[_0xae47('0x38')]=_[_0xae47('0x4a')](_0x111b8c[_0xae47('0x35')],qs[_0xae47('0x39')](_0x2f3ae9[_0xae47('0x36')][_0xae47('0x39')]));_0x38130f[_0xae47('0x38')]=_0x38130f[_0xae47('0x38')][_0xae47('0x3a')]?_0x38130f['attributes']:_0x111b8c[_0xae47('0x35')];if(_0x2f3ae9[_0xae47('0x36')]['includeAll']){_0x38130f['include']=[{'all':!![]}];}_0x38130f=_[_0xae47('0x40')]({},_0x38130f,_0x2f3ae9[_0xae47('0x4b')]);return db[_0xae47('0x43')][_0xae47('0x4c')](_0x38130f)['then'](handleEntityNotFound(_0x4f62b1,null))[_0xae47('0x2a')](respondWithResult(_0x4f62b1,null))[_0xae47('0x47')](handleError(_0x4f62b1,null));};exports[_0xae47('0x4d')]=function(_0x17aa03,_0x330819){return db[_0xae47('0x43')][_0xae47('0x4d')](_0x17aa03[_0xae47('0x4e')],{})[_0xae47('0x2a')](respondWithResult(_0x330819,0xc9))[_0xae47('0x47')](handleError(_0x330819,null));};exports['update']=function(_0x57302d,_0x3fd216){if(_0x57302d['body']['id']){delete _0x57302d[_0xae47('0x4e')]['id'];}return db['ZendeskConfiguration'][_0xae47('0x4c')]({'where':{'id':_0x57302d[_0xae47('0x49')]['id']}})['then'](handleEntityNotFound(_0x3fd216,null))[_0xae47('0x2a')](saveUpdates(_0x57302d[_0xae47('0x4e')],null))['then'](respondWithResult(_0x3fd216,null))[_0xae47('0x47')](handleError(_0x3fd216,null));};exports[_0xae47('0x2b')]=function(_0x31abde,_0x20b353){return db[_0xae47('0x43')]['find']({'where':{'id':_0x31abde[_0xae47('0x49')]['id']}})[_0xae47('0x2a')](handleEntityNotFound(_0x20b353,null))[_0xae47('0x2a')](removeEntity(_0x20b353,null))[_0xae47('0x47')](handleError(_0x20b353,null));};exports[_0xae47('0x4f')]=function(_0x3ee400,_0x40f349,_0x20d4d6){var _0x21616e={};var _0x251f16={};var _0x983ddf;var _0x33dc52;return db[_0xae47('0x43')][_0xae47('0x50')]({'where':{'id':_0x3ee400[_0xae47('0x49')]['id']}})[_0xae47('0x2a')](handleEntityNotFound(_0x40f349,null))['then'](function(_0x1db56a){if(_0x1db56a){_0x983ddf=_0x1db56a;_0x251f16[_0xae47('0x35')]=_['keys'](db[_0xae47('0x51')][_0xae47('0x32')]);_0x251f16[_0xae47('0x36')]=_[_0xae47('0x37')](_0x3ee400[_0xae47('0x36')]);_0x251f16[_0xae47('0x3e')]=_[_0xae47('0x4a')](_0x251f16[_0xae47('0x35')],_0x251f16['query']);_0x21616e[_0xae47('0x38')]=_[_0xae47('0x4a')](_0x251f16[_0xae47('0x35')],qs['fields'](_0x3ee400['query'][_0xae47('0x39')]));_0x21616e[_0xae47('0x38')]=_0x21616e['attributes'][_0xae47('0x3a')]?_0x21616e[_0xae47('0x38')]:_0x251f16['model'];_0x21616e[_0xae47('0x52')]=qs[_0xae47('0x3c')](_0x3ee400[_0xae47('0x36')][_0xae47('0x3c')]);_0x21616e[_0xae47('0x41')]=qs[_0xae47('0x3e')](_[_0xae47('0x3d')](_0x3ee400['query'],_0x251f16['filters']));if(_0x3ee400[_0xae47('0x36')][_0xae47('0x3f')]){_0x21616e[_0xae47('0x41')]=_[_0xae47('0x40')](_0x21616e[_0xae47('0x41')],{'$or':_[_0xae47('0x31')](_0x21616e['attributes'],function(_0x5e90b4){var _0x5f0e0f={};_0x5f0e0f[_0x5e90b4]={'$like':'%'+_0x3ee400[_0xae47('0x36')][_0xae47('0x3f')]+'%'};return _0x5f0e0f;})});}_0x21616e=_[_0xae47('0x40')]({},_0x21616e,_0x3ee400['options']);return _0x983ddf[_0xae47('0x4f')](_0x21616e);}})[_0xae47('0x2a')](function(_0x47085b){if(_0x47085b){_0x33dc52=_0x47085b[_0xae47('0x3a')];if(!_0x3ee400[_0xae47('0x36')][_0xae47('0x53')](_0xae47('0x3b'))){_0x21616e[_0xae47('0x21')]=qs[_0xae47('0x21')](_0x3ee400[_0xae47('0x36')][_0xae47('0x21')]);_0x21616e[_0xae47('0x23')]=qs[_0xae47('0x23')](_0x3ee400['query'][_0xae47('0x23')]);}return _0x983ddf[_0xae47('0x4f')](_0x21616e);}})[_0xae47('0x2a')](function(_0x236abd){if(_0x236abd){return _0x236abd?{'count':_0x33dc52,'rows':_0x236abd}:null;}})[_0xae47('0x2a')](respondWithResult(_0x40f349,null))[_0xae47('0x47')](handleError(_0x40f349,null));};exports[_0xae47('0x54')]=function(_0x234931,_0x46be4c,_0x5a5e03){var _0x4e7930={};var _0x132b88={};var _0x5f3b62;var _0x2a0f3c;return db[_0xae47('0x43')][_0xae47('0x50')]({'where':{'id':_0x234931[_0xae47('0x49')]['id']}})[_0xae47('0x2a')](handleEntityNotFound(_0x46be4c,null))['then'](function(_0x4ba263){if(_0x4ba263){_0x5f3b62=_0x4ba263;_0x132b88[_0xae47('0x35')]=_['keys'](db[_0xae47('0x51')][_0xae47('0x32')]);_0x132b88[_0xae47('0x36')]=_[_0xae47('0x37')](_0x234931[_0xae47('0x36')]);_0x132b88['filters']=_['intersection'](_0x132b88[_0xae47('0x35')],_0x132b88['query']);_0x4e7930[_0xae47('0x38')]=_[_0xae47('0x4a')](_0x132b88[_0xae47('0x35')],qs[_0xae47('0x39')](_0x234931[_0xae47('0x36')]['fields']));_0x4e7930['attributes']=_0x4e7930[_0xae47('0x38')][_0xae47('0x3a')]?_0x4e7930[_0xae47('0x38')]:_0x132b88['model'];_0x4e7930[_0xae47('0x52')]=qs[_0xae47('0x3c')](_0x234931['query'][_0xae47('0x3c')]);_0x4e7930[_0xae47('0x41')]=qs[_0xae47('0x3e')](_[_0xae47('0x3d')](_0x234931[_0xae47('0x36')],_0x132b88[_0xae47('0x3e')]));if(_0x234931['query'][_0xae47('0x3f')]){_0x4e7930[_0xae47('0x41')]=_[_0xae47('0x40')](_0x4e7930[_0xae47('0x41')],{'$or':_[_0xae47('0x31')](_0x4e7930['attributes'],function(_0x470fdf){var _0x1a7d92={};_0x1a7d92[_0x470fdf]={'$like':'%'+_0x234931[_0xae47('0x36')][_0xae47('0x3f')]+'%'};return _0x1a7d92;})});}_0x4e7930=_[_0xae47('0x40')]({},_0x4e7930,_0x234931['options']);return _0x5f3b62['getSubjects'](_0x4e7930);}})['then'](function(_0x531b42){if(_0x531b42){_0x2a0f3c=_0x531b42[_0xae47('0x3a')];if(!_0x234931['query'][_0xae47('0x53')]('nolimit')){_0x4e7930[_0xae47('0x21')]=qs[_0xae47('0x21')](_0x234931[_0xae47('0x36')][_0xae47('0x21')]);_0x4e7930[_0xae47('0x23')]=qs[_0xae47('0x23')](_0x234931[_0xae47('0x36')][_0xae47('0x23')]);}return _0x5f3b62[_0xae47('0x54')](_0x4e7930);}})[_0xae47('0x2a')](function(_0x460e3f){if(_0x460e3f){return _0x460e3f?{'count':_0x2a0f3c,'rows':_0x460e3f}:null;}})[_0xae47('0x2a')](respondWithResult(_0x46be4c,null))[_0xae47('0x47')](handleError(_0x46be4c,null));};exports['getDescriptions']=function(_0x332415,_0xc24084,_0x5f1f99){var _0x46d918={};var _0x4b0401={};var _0x6b5750;var _0x4bc0b4;return db[_0xae47('0x43')][_0xae47('0x50')]({'where':{'id':_0x332415[_0xae47('0x49')]['id']}})[_0xae47('0x2a')](handleEntityNotFound(_0xc24084,null))[_0xae47('0x2a')](function(_0x50016a){if(_0x50016a){_0x6b5750=_0x50016a;_0x4b0401[_0xae47('0x35')]=_['keys'](db[_0xae47('0x51')]['rawAttributes']);_0x4b0401[_0xae47('0x36')]=_[_0xae47('0x37')](_0x332415['query']);_0x4b0401[_0xae47('0x3e')]=_[_0xae47('0x4a')](_0x4b0401['model'],_0x4b0401[_0xae47('0x36')]);_0x46d918['attributes']=_['intersection'](_0x4b0401[_0xae47('0x35')],qs[_0xae47('0x39')](_0x332415[_0xae47('0x36')][_0xae47('0x39')]));_0x46d918[_0xae47('0x38')]=_0x46d918[_0xae47('0x38')][_0xae47('0x3a')]?_0x46d918[_0xae47('0x38')]:_0x4b0401['model'];_0x46d918[_0xae47('0x52')]=qs['sort'](_0x332415[_0xae47('0x36')]['sort']);_0x46d918['where']=qs[_0xae47('0x3e')](_[_0xae47('0x3d')](_0x332415['query'],_0x4b0401[_0xae47('0x3e')]));if(_0x332415[_0xae47('0x36')][_0xae47('0x3f')]){_0x46d918[_0xae47('0x41')]=_['merge'](_0x46d918[_0xae47('0x41')],{'$or':_[_0xae47('0x31')](_0x46d918[_0xae47('0x38')],function(_0x56d655){var _0x3d05dd={};_0x3d05dd[_0x56d655]={'$like':'%'+_0x332415[_0xae47('0x36')][_0xae47('0x3f')]+'%'};return _0x3d05dd;})});}_0x46d918=_['merge']({},_0x46d918,_0x332415['options']);return _0x6b5750[_0xae47('0x55')](_0x46d918);}})[_0xae47('0x2a')](function(_0x24c140){if(_0x24c140){_0x4bc0b4=_0x24c140[_0xae47('0x3a')];if(!_0x332415[_0xae47('0x36')][_0xae47('0x53')]('nolimit')){_0x46d918[_0xae47('0x21')]=qs[_0xae47('0x21')](_0x332415['query'][_0xae47('0x21')]);_0x46d918['offset']=qs[_0xae47('0x23')](_0x332415[_0xae47('0x36')][_0xae47('0x23')]);}return _0x6b5750[_0xae47('0x55')](_0x46d918);}})[_0xae47('0x2a')](function(_0x5ae8d3){if(_0x5ae8d3){return _0x5ae8d3?{'count':_0x4bc0b4,'rows':_0x5ae8d3}:null;}})[_0xae47('0x2a')](respondWithResult(_0xc24084,null))[_0xae47('0x47')](handleError(_0xc24084,null));};exports[_0xae47('0x56')]=function(_0x1d0455,_0x5ae7bc,_0x323759){var _0x1147c4={};var _0x6c85cc={};var _0x31d2fe;var _0x4bcc30;return db[_0xae47('0x43')][_0xae47('0x50')]({'where':{'id':_0x1d0455[_0xae47('0x49')]['id']}})[_0xae47('0x2a')](handleEntityNotFound(_0x5ae7bc,null))[_0xae47('0x2a')](function(_0x23ff21){if(_0x23ff21){_0x31d2fe=_0x23ff21;_0x6c85cc[_0xae47('0x35')]=_[_0xae47('0x37')](db[_0xae47('0x57')][_0xae47('0x32')]);_0x6c85cc['query']=_[_0xae47('0x37')](_0x1d0455[_0xae47('0x36')]);_0x6c85cc[_0xae47('0x3e')]=_[_0xae47('0x4a')](_0x6c85cc[_0xae47('0x35')],_0x6c85cc[_0xae47('0x36')]);_0x1147c4[_0xae47('0x38')]=_[_0xae47('0x4a')](_0x6c85cc['model'],qs['fields'](_0x1d0455[_0xae47('0x36')][_0xae47('0x39')]));_0x1147c4[_0xae47('0x38')]=_0x1147c4[_0xae47('0x38')][_0xae47('0x3a')]?_0x1147c4['attributes']:_0x6c85cc['model'];_0x1147c4[_0xae47('0x52')]=qs[_0xae47('0x3c')](_0x1d0455[_0xae47('0x36')][_0xae47('0x3c')]);_0x1147c4[_0xae47('0x41')]=qs[_0xae47('0x3e')](_[_0xae47('0x3d')](_0x1d0455[_0xae47('0x36')],_0x6c85cc[_0xae47('0x3e')]));if(_0x1d0455[_0xae47('0x36')][_0xae47('0x3f')]){_0x1147c4[_0xae47('0x41')]=_[_0xae47('0x40')](_0x1147c4[_0xae47('0x41')],{'$or':_[_0xae47('0x31')](_0x1147c4[_0xae47('0x38')],function(_0x32882c){var _0x49ee04={};_0x49ee04[_0x32882c]={'$like':'%'+_0x1d0455[_0xae47('0x36')][_0xae47('0x3f')]+'%'};return _0x49ee04;})});}_0x1147c4=_[_0xae47('0x40')]({},_0x1147c4,_0x1d0455[_0xae47('0x4b')]);return _0x31d2fe[_0xae47('0x56')](_0x1147c4);}})[_0xae47('0x2a')](function(_0xefe0c1){if(_0xefe0c1){_0x4bcc30=_0xefe0c1['length'];if(!_0x1d0455[_0xae47('0x36')]['hasOwnProperty'](_0xae47('0x3b'))){_0x1147c4[_0xae47('0x21')]=qs[_0xae47('0x21')](_0x1d0455['query']['limit']);_0x1147c4[_0xae47('0x23')]=qs[_0xae47('0x23')](_0x1d0455['query'][_0xae47('0x23')]);}return _0x31d2fe[_0xae47('0x56')](_0x1147c4);}})['then'](function(_0xedfc79){if(_0xedfc79){return _0xedfc79?{'count':_0x4bcc30,'rows':_0xedfc79}:null;}})[_0xae47('0x2a')](respondWithResult(_0x5ae7bc,null))['catch'](handleError(_0x5ae7bc,null));};exports[_0xae47('0x58')]=function(_0x57ea2f,_0xfe9616,_0x373407){if(_0x57ea2f[_0xae47('0x4e')]['id']){delete _0x57ea2f[_0xae47('0x4e')]['id'];}return db['ZendeskConfiguration'][_0xae47('0x50')]({'where':{'id':_0x57ea2f[_0xae47('0x49')]['id']}})[_0xae47('0x2a')](handleEntityNotFound(_0xfe9616,null))[_0xae47('0x2a')](function(_0x3e2010){if(_0x3e2010){return _0x3e2010[_0xae47('0x58')](_0x57ea2f['body'][_0xae47('0x59')]||[]);}return null;})[_0xae47('0x2a')](respondWithResult(_0xfe9616,null))[_0xae47('0x47')](handleError(_0xfe9616,null));};
\ No newline at end of file