Built motion from commit 52c8a02d.|2.6.29
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index 146924f..7c90b90 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1bae=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','stack','name','index','ZendeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','count','includeAll','include','rows','params','attributes','length','find','create','update','body','findOne','ZendeskField','options','getFields','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x16727b,_0x3d7f6a){var _0x560ece=function(_0x3a6e6a){while(--_0x3a6e6a){_0x16727b['push'](_0x16727b['shift']());}};_0x560ece(++_0x3d7f6a);}(_0x1bae,0xb3));var _0xe1ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bae[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xe1ba('0x0'));var emlformat=require(_0xe1ba('0x1'));var rimraf=require(_0xe1ba('0x2'));var zipdir=require(_0xe1ba('0x3'));var jsonpatch=require(_0xe1ba('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe1ba('0x5'));var util=require(_0xe1ba('0x6'));var path=require('path');var sox=require(_0xe1ba('0x7'));var csv=require(_0xe1ba('0x8'));var ejs=require(_0xe1ba('0x9'));var fs=require('fs');var _=require(_0xe1ba('0xa'));var squel=require(_0xe1ba('0xb'));var crypto=require(_0xe1ba('0xc'));var jsforce=require(_0xe1ba('0xd'));var deskjs=require(_0xe1ba('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe1ba('0xf'));var Redis=require(_0xe1ba('0x10'));var authService=require(_0xe1ba('0x11'));var qs=require(_0xe1ba('0x12'));var as=require(_0xe1ba('0x13'));var hardwareService=require(_0xe1ba('0x14'));var logger=require(_0xe1ba('0x15'))(_0xe1ba('0x16'));var utils=require(_0xe1ba('0x17'));var config=require(_0xe1ba('0x18'));var licenseUtil=require(_0xe1ba('0x19'));var db=require(_0xe1ba('0x1a'))['db'];var jayson=require(_0xe1ba('0x1b'));var client=jayson[_0xe1ba('0x1c')][_0xe1ba('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x130021,_0x27303e,_0x59b382,_0x36d951){return new BPromise(function(_0x19a591,_0x586410){var _0x3c315a=_0x36d951||client;return _0x3c315a[_0xe1ba('0x1e')](_0x130021,_0x59b382)[_0xe1ba('0x1f')](function(_0x3502b1){logger['info'](_0xe1ba('0x20'),_0x27303e,'request\x20sent');logger[_0xe1ba('0x21')](_0xe1ba('0x22'),_0x27303e,_0xe1ba('0x23'),JSON[_0xe1ba('0x24')](_0x3502b1));if(_0x3502b1['error']){if(_0x3502b1[_0xe1ba('0x25')][_0xe1ba('0x26')]===0x1f4){logger[_0xe1ba('0x25')](_0xe1ba('0x20'),_0x27303e,_0x3502b1[_0xe1ba('0x25')][_0xe1ba('0x27')]);return _0x586410(_0x3502b1[_0xe1ba('0x25')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x27303e,_0x3502b1['error']['message']);return _0x19a591(_0x3502b1[_0xe1ba('0x25')][_0xe1ba('0x27')]);}else{logger[_0xe1ba('0x28')](_0xe1ba('0x20'),_0x27303e,_0xe1ba('0x23'));_0x19a591(_0x3502b1[_0xe1ba('0x29')][_0xe1ba('0x27')]);}})[_0xe1ba('0x2a')](function(_0x14d38b){logger['error'](_0xe1ba('0x20'),_0x27303e,_0x14d38b);_0x586410(_0x14d38b);});});}function respondWithStatusCode(_0x51bb4e,_0x21bd1c){_0x21bd1c=_0x21bd1c||0xcc;return function(_0x5d0e2e){if(_0x5d0e2e){return _0x51bb4e[_0xe1ba('0x2b')](_0x21bd1c);}return _0x51bb4e[_0xe1ba('0x2c')](_0x21bd1c)[_0xe1ba('0x2d')]();};}function respondWithResult(_0x2bd894,_0x3be623){_0x3be623=_0x3be623||0xc8;return function(_0x49fa57){if(_0x49fa57){return _0x2bd894['status'](_0x3be623)[_0xe1ba('0x2e')](_0x49fa57);}};}function respondWithFilteredResult(_0x37c767,_0x271813){return function(_0x40ed9e){if(_0x40ed9e){var _0x82fe3d=_0x40ed9e['count'],_0x39593e=_0x271813[_0xe1ba('0x2f')],_0x2e8dad=_0x271813[_0xe1ba('0x2f')]+_0x271813[_0xe1ba('0x30')],_0x51dfce;if(_0x2e8dad>=_0x82fe3d){_0x2e8dad=_0x82fe3d;_0x51dfce=0xc8;}else{_0x51dfce=0xce;}_0x37c767[_0xe1ba('0x2c')](_0x51dfce);return _0x37c767[_0xe1ba('0x31')](_0xe1ba('0x32'),_0x39593e+'-'+_0x2e8dad+'/'+_0x82fe3d)['json'](_0x40ed9e);}return null;};}function patchUpdates(_0x3c7622){return function(_0x1361dc){try{jsonpatch['apply'](_0x1361dc,_0x3c7622,!![]);}catch(_0x3b4eb3){return BPromise[_0xe1ba('0x33')](_0x3b4eb3);}return _0x1361dc['save']();};}function saveUpdates(_0x2dd5bc,_0x2a6814){return function(_0x24fef7){if(_0x24fef7){return _0x24fef7['update'](_0x2dd5bc)[_0xe1ba('0x1f')](function(_0x3e350f){return _0x3e350f;});}return null;};}function removeEntity(_0x5c7e8a,_0x1d3d2e){return function(_0x477afc){if(_0x477afc){return _0x477afc['destroy']()[_0xe1ba('0x1f')](function(){_0x5c7e8a[_0xe1ba('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x461bde,_0x594c53){return function(_0xbf5d45){if(!_0xbf5d45){_0x461bde[_0xe1ba('0x2b')](0x194);}return _0xbf5d45;};}function handleError(_0x217ca6,_0xfa817b){_0xfa817b=_0xfa817b||0x1f4;return function(_0x24dbe4){logger[_0xe1ba('0x25')](_0x24dbe4[_0xe1ba('0x34')]);if(_0x24dbe4[_0xe1ba('0x35')]){delete _0x24dbe4[_0xe1ba('0x35')];}_0x217ca6[_0xe1ba('0x2c')](_0xfa817b)['send'](_0x24dbe4);};}exports[_0xe1ba('0x36')]=function(_0x15cbfb,_0x1f9acc){var _0x3e9391={},_0x43d2c8={},_0x188afa={'count':0x0,'rows':[]};var _0x4541e8=_['map'](db[_0xe1ba('0x37')][_0xe1ba('0x38')],function(_0xe8ba30){return{'name':_0xe8ba30[_0xe1ba('0x39')],'type':_0xe8ba30[_0xe1ba('0x3a')]['key']};});_0x43d2c8['model']=_['map'](_0x4541e8,_0xe1ba('0x35'));_0x43d2c8[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x15cbfb[_0xe1ba('0x3b')]);_0x43d2c8[_0xe1ba('0x3d')]=_[_0xe1ba('0x3e')](_0x43d2c8[_0xe1ba('0x3f')],_0x43d2c8[_0xe1ba('0x3b')]);_0x3e9391['attributes']=_[_0xe1ba('0x3e')](_0x43d2c8[_0xe1ba('0x3f')],qs['fields'](_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x40')]));_0x3e9391['attributes']=_0x3e9391['attributes']['length']?_0x3e9391['attributes']:_0x43d2c8[_0xe1ba('0x3f')];if(!_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x41')]('nolimit')){_0x3e9391['limit']=qs[_0xe1ba('0x30')](_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x30')]);_0x3e9391[_0xe1ba('0x2f')]=qs[_0xe1ba('0x2f')](_0x15cbfb['query'][_0xe1ba('0x2f')]);}_0x3e9391[_0xe1ba('0x42')]=qs[_0xe1ba('0x43')](_0x15cbfb[_0xe1ba('0x3b')]['sort']);_0x3e9391[_0xe1ba('0x44')]=qs[_0xe1ba('0x3d')](_[_0xe1ba('0x45')](_0x15cbfb['query'],_0x43d2c8[_0xe1ba('0x3d')]),_0x4541e8);if(_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x46')]){_0x3e9391[_0xe1ba('0x44')]=_[_0xe1ba('0x47')](_0x3e9391[_0xe1ba('0x44')],{'$or':_[_0xe1ba('0x48')](_0x4541e8,function(_0x39ba71){if(_0x39ba71[_0xe1ba('0x3a')]!==_0xe1ba('0x49')){var _0xa567d1={};_0xa567d1[_0x39ba71['name']]={'$like':'%'+_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0xa567d1;}})});}_0x3e9391=_[_0xe1ba('0x47')]({},_0x3e9391,_0x15cbfb['options']);var _0x5f4b6e={'where':_0x3e9391[_0xe1ba('0x44')]};return db[_0xe1ba('0x37')][_0xe1ba('0x4a')](_0x5f4b6e)[_0xe1ba('0x1f')](function(_0x190e48){_0x188afa[_0xe1ba('0x4a')]=_0x190e48;if(_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x4b')]){_0x3e9391[_0xe1ba('0x4c')]=[{'all':!![]}];}return db[_0xe1ba('0x37')]['findAll'](_0x3e9391);})[_0xe1ba('0x1f')](function(_0x5343e0){_0x188afa[_0xe1ba('0x4d')]=_0x5343e0;return _0x188afa;})[_0xe1ba('0x1f')](respondWithFilteredResult(_0x1f9acc,_0x3e9391))[_0xe1ba('0x2a')](handleError(_0x1f9acc,null));};exports['show']=function(_0x15812c,_0x4c11ee){var _0x9f589={'raw':![],'where':{'id':_0x15812c[_0xe1ba('0x4e')]['id']}},_0xeb85b1={};_0xeb85b1['model']=_['keys'](db['ZendeskConfiguration'][_0xe1ba('0x38')]);_0xeb85b1[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x15812c[_0xe1ba('0x3b')]);_0xeb85b1[_0xe1ba('0x3d')]=_[_0xe1ba('0x3e')](_0xeb85b1[_0xe1ba('0x3f')],_0xeb85b1[_0xe1ba('0x3b')]);_0x9f589[_0xe1ba('0x4f')]=_[_0xe1ba('0x3e')](_0xeb85b1[_0xe1ba('0x3f')],qs[_0xe1ba('0x40')](_0x15812c[_0xe1ba('0x3b')][_0xe1ba('0x40')]));_0x9f589['attributes']=_0x9f589[_0xe1ba('0x4f')][_0xe1ba('0x50')]?_0x9f589['attributes']:_0xeb85b1[_0xe1ba('0x3f')];if(_0x15812c[_0xe1ba('0x3b')][_0xe1ba('0x4b')]){_0x9f589['include']=[{'all':!![]}];}_0x9f589=_[_0xe1ba('0x47')]({},_0x9f589,_0x15812c['options']);return db[_0xe1ba('0x37')][_0xe1ba('0x51')](_0x9f589)[_0xe1ba('0x1f')](handleEntityNotFound(_0x4c11ee,null))[_0xe1ba('0x1f')](respondWithResult(_0x4c11ee,null))[_0xe1ba('0x2a')](handleError(_0x4c11ee,null));};exports[_0xe1ba('0x52')]=function(_0x211241,_0x10585b){return db[_0xe1ba('0x37')][_0xe1ba('0x52')](_0x211241['body'],{})['then'](respondWithResult(_0x10585b,0xc9))[_0xe1ba('0x2a')](handleError(_0x10585b,null));};exports[_0xe1ba('0x53')]=function(_0x22b540,_0x74f8b1){if(_0x22b540[_0xe1ba('0x54')]['id']){delete _0x22b540[_0xe1ba('0x54')]['id'];}return db[_0xe1ba('0x37')]['find']({'where':{'id':_0x22b540[_0xe1ba('0x4e')]['id']}})['then'](handleEntityNotFound(_0x74f8b1,null))['then'](saveUpdates(_0x22b540['body'],null))['then'](respondWithResult(_0x74f8b1,null))['catch'](handleError(_0x74f8b1,null));};exports['destroy']=function(_0x2996f3,_0x91bd11){return db[_0xe1ba('0x37')][_0xe1ba('0x51')]({'where':{'id':_0x2996f3[_0xe1ba('0x4e')]['id']}})[_0xe1ba('0x1f')](handleEntityNotFound(_0x91bd11,null))[_0xe1ba('0x1f')](removeEntity(_0x91bd11,null))[_0xe1ba('0x2a')](handleError(_0x91bd11,null));};exports['getFields']=function(_0x3a8ded,_0x257760,_0x12ea6f){var _0x244e8e={};var _0x59546e={};var _0x21c82e;var _0x11fba1;return db['ZendeskConfiguration'][_0xe1ba('0x55')]({'where':{'id':_0x3a8ded['params']['id']}})['then'](handleEntityNotFound(_0x257760,null))[_0xe1ba('0x1f')](function(_0x6a3f8f){if(_0x6a3f8f){_0x21c82e=_0x6a3f8f;_0x59546e[_0xe1ba('0x3f')]=_[_0xe1ba('0x3c')](db[_0xe1ba('0x56')]['rawAttributes']);_0x59546e['query']=_[_0xe1ba('0x3c')](_0x3a8ded[_0xe1ba('0x3b')]);_0x59546e[_0xe1ba('0x3d')]=_['intersection'](_0x59546e[_0xe1ba('0x3f')],_0x59546e[_0xe1ba('0x3b')]);_0x244e8e['attributes']=_[_0xe1ba('0x3e')](_0x59546e[_0xe1ba('0x3f')],qs['fields'](_0x3a8ded[_0xe1ba('0x3b')][_0xe1ba('0x40')]));_0x244e8e[_0xe1ba('0x4f')]=_0x244e8e[_0xe1ba('0x4f')][_0xe1ba('0x50')]?_0x244e8e[_0xe1ba('0x4f')]:_0x59546e[_0xe1ba('0x3f')];_0x244e8e[_0xe1ba('0x42')]=qs[_0xe1ba('0x43')](_0x3a8ded[_0xe1ba('0x3b')][_0xe1ba('0x43')]);_0x244e8e['where']=qs[_0xe1ba('0x3d')](_[_0xe1ba('0x45')](_0x3a8ded['query'],_0x59546e[_0xe1ba('0x3d')]));if(_0x3a8ded[_0xe1ba('0x3b')]['filter']){_0x244e8e[_0xe1ba('0x44')]=_[_0xe1ba('0x47')](_0x244e8e[_0xe1ba('0x44')],{'$or':_[_0xe1ba('0x48')](_0x244e8e['attributes'],function(_0x732fa4){var _0x3f6b6d={};_0x3f6b6d[_0x732fa4]={'$like':'%'+_0x3a8ded[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0x3f6b6d;})});}_0x244e8e=_[_0xe1ba('0x47')]({},_0x244e8e,_0x3a8ded[_0xe1ba('0x57')]);return _0x21c82e[_0xe1ba('0x58')](_0x244e8e);}})[_0xe1ba('0x1f')](function(_0x26be7f){if(_0x26be7f){_0x11fba1=_0x26be7f[_0xe1ba('0x50')];if(!_0x3a8ded[_0xe1ba('0x3b')][_0xe1ba('0x41')](_0xe1ba('0x59'))){_0x244e8e[_0xe1ba('0x30')]=qs[_0xe1ba('0x30')](_0x3a8ded['query'][_0xe1ba('0x30')]);_0x244e8e[_0xe1ba('0x2f')]=qs[_0xe1ba('0x2f')](_0x3a8ded['query']['offset']);}return _0x21c82e[_0xe1ba('0x58')](_0x244e8e);}})[_0xe1ba('0x1f')](function(_0x58d4d7){if(_0x58d4d7){return _0x58d4d7?{'count':_0x11fba1,'rows':_0x58d4d7}:null;}})[_0xe1ba('0x1f')](respondWithResult(_0x257760,null))[_0xe1ba('0x2a')](handleError(_0x257760,null));};exports[_0xe1ba('0x5a')]=function(_0x3f487b,_0x4727fa,_0x35c477){var _0x1252df={};var _0x202ec1={};var _0x1bfd97;var _0x19d8d7;return db[_0xe1ba('0x37')]['findOne']({'where':{'id':_0x3f487b['params']['id']}})[_0xe1ba('0x1f')](handleEntityNotFound(_0x4727fa,null))[_0xe1ba('0x1f')](function(_0x30f5a1){if(_0x30f5a1){_0x1bfd97=_0x30f5a1;_0x202ec1['model']=_[_0xe1ba('0x3c')](db['ZendeskField'][_0xe1ba('0x38')]);_0x202ec1['query']=_[_0xe1ba('0x3c')](_0x3f487b[_0xe1ba('0x3b')]);_0x202ec1[_0xe1ba('0x3d')]=_['intersection'](_0x202ec1[_0xe1ba('0x3f')],_0x202ec1[_0xe1ba('0x3b')]);_0x1252df['attributes']=_['intersection'](_0x202ec1[_0xe1ba('0x3f')],qs['fields'](_0x3f487b['query'][_0xe1ba('0x40')]));_0x1252df['attributes']=_0x1252df[_0xe1ba('0x4f')][_0xe1ba('0x50')]?_0x1252df[_0xe1ba('0x4f')]:_0x202ec1[_0xe1ba('0x3f')];_0x1252df[_0xe1ba('0x42')]=qs[_0xe1ba('0x43')](_0x3f487b['query']['sort']);_0x1252df[_0xe1ba('0x44')]=qs[_0xe1ba('0x3d')](_[_0xe1ba('0x45')](_0x3f487b['query'],_0x202ec1[_0xe1ba('0x3d')]));if(_0x3f487b['query']['filter']){_0x1252df[_0xe1ba('0x44')]=_[_0xe1ba('0x47')](_0x1252df['where'],{'$or':_['map'](_0x1252df[_0xe1ba('0x4f')],function(_0x533da8){var _0x1b3768={};_0x1b3768[_0x533da8]={'$like':'%'+_0x3f487b[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0x1b3768;})});}_0x1252df=_['merge']({},_0x1252df,_0x3f487b[_0xe1ba('0x57')]);return _0x1bfd97[_0xe1ba('0x5a')](_0x1252df);}})[_0xe1ba('0x1f')](function(_0x440f53){if(_0x440f53){_0x19d8d7=_0x440f53['length'];if(!_0x3f487b[_0xe1ba('0x3b')][_0xe1ba('0x41')](_0xe1ba('0x59'))){_0x1252df[_0xe1ba('0x30')]=qs['limit'](_0x3f487b[_0xe1ba('0x3b')][_0xe1ba('0x30')]);_0x1252df[_0xe1ba('0x2f')]=qs[_0xe1ba('0x2f')](_0x3f487b[_0xe1ba('0x3b')][_0xe1ba('0x2f')]);}return _0x1bfd97[_0xe1ba('0x5a')](_0x1252df);}})[_0xe1ba('0x1f')](function(_0x24849b){if(_0x24849b){return _0x24849b?{'count':_0x19d8d7,'rows':_0x24849b}:null;}})[_0xe1ba('0x1f')](respondWithResult(_0x4727fa,null))[_0xe1ba('0x2a')](handleError(_0x4727fa,null));};exports[_0xe1ba('0x5b')]=function(_0x277a69,_0x4ebfcb,_0x673aa9){var _0x1a6092={};var _0x4ae0a6={};var _0x14b119;var _0x50d849;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x277a69[_0xe1ba('0x4e')]['id']}})[_0xe1ba('0x1f')](handleEntityNotFound(_0x4ebfcb,null))['then'](function(_0x41ffc7){if(_0x41ffc7){_0x14b119=_0x41ffc7;_0x4ae0a6[_0xe1ba('0x3f')]=_['keys'](db[_0xe1ba('0x56')][_0xe1ba('0x38')]);_0x4ae0a6[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x277a69[_0xe1ba('0x3b')]);_0x4ae0a6[_0xe1ba('0x3d')]=_[_0xe1ba('0x3e')](_0x4ae0a6[_0xe1ba('0x3f')],_0x4ae0a6['query']);_0x1a6092[_0xe1ba('0x4f')]=_[_0xe1ba('0x3e')](_0x4ae0a6[_0xe1ba('0x3f')],qs['fields'](_0x277a69[_0xe1ba('0x3b')][_0xe1ba('0x40')]));_0x1a6092[_0xe1ba('0x4f')]=_0x1a6092[_0xe1ba('0x4f')][_0xe1ba('0x50')]?_0x1a6092[_0xe1ba('0x4f')]:_0x4ae0a6[_0xe1ba('0x3f')];_0x1a6092[_0xe1ba('0x42')]=qs[_0xe1ba('0x43')](_0x277a69[_0xe1ba('0x3b')]['sort']);_0x1a6092[_0xe1ba('0x44')]=qs[_0xe1ba('0x3d')](_[_0xe1ba('0x45')](_0x277a69['query'],_0x4ae0a6['filters']));if(_0x277a69['query'][_0xe1ba('0x46')]){_0x1a6092[_0xe1ba('0x44')]=_[_0xe1ba('0x47')](_0x1a6092[_0xe1ba('0x44')],{'$or':_['map'](_0x1a6092[_0xe1ba('0x4f')],function(_0x4fae13){var _0x46d476={};_0x46d476[_0x4fae13]={'$like':'%'+_0x277a69[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0x46d476;})});}_0x1a6092=_[_0xe1ba('0x47')]({},_0x1a6092,_0x277a69[_0xe1ba('0x57')]);return _0x14b119[_0xe1ba('0x5b')](_0x1a6092);}})[_0xe1ba('0x1f')](function(_0x1493a1){if(_0x1493a1){_0x50d849=_0x1493a1[_0xe1ba('0x50')];if(!_0x277a69['query'][_0xe1ba('0x41')](_0xe1ba('0x59'))){_0x1a6092[_0xe1ba('0x30')]=qs[_0xe1ba('0x30')](_0x277a69[_0xe1ba('0x3b')][_0xe1ba('0x30')]);_0x1a6092[_0xe1ba('0x2f')]=qs[_0xe1ba('0x2f')](_0x277a69['query'][_0xe1ba('0x2f')]);}return _0x14b119[_0xe1ba('0x5b')](_0x1a6092);}})['then'](function(_0x3ab59d){if(_0x3ab59d){return _0x3ab59d?{'count':_0x50d849,'rows':_0x3ab59d}:null;}})[_0xe1ba('0x1f')](respondWithResult(_0x4ebfcb,null))['catch'](handleError(_0x4ebfcb,null));};exports[_0xe1ba('0x5c')]=function(_0x322d51,_0x8b3a01,_0x345a54){var _0x31d96b={};var _0x28ce4c={};var _0x1b99fe;var _0x17ba72;return db[_0xe1ba('0x37')][_0xe1ba('0x55')]({'where':{'id':_0x322d51[_0xe1ba('0x4e')]['id']}})[_0xe1ba('0x1f')](handleEntityNotFound(_0x8b3a01,null))[_0xe1ba('0x1f')](function(_0x3bf3c0){if(_0x3bf3c0){_0x1b99fe=_0x3bf3c0;_0x28ce4c[_0xe1ba('0x3f')]=_[_0xe1ba('0x3c')](db[_0xe1ba('0x5d')]['rawAttributes']);_0x28ce4c[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x322d51[_0xe1ba('0x3b')]);_0x28ce4c[_0xe1ba('0x3d')]=_['intersection'](_0x28ce4c[_0xe1ba('0x3f')],_0x28ce4c[_0xe1ba('0x3b')]);_0x31d96b[_0xe1ba('0x4f')]=_[_0xe1ba('0x3e')](_0x28ce4c['model'],qs[_0xe1ba('0x40')](_0x322d51[_0xe1ba('0x3b')][_0xe1ba('0x40')]));_0x31d96b[_0xe1ba('0x4f')]=_0x31d96b['attributes'][_0xe1ba('0x50')]?_0x31d96b['attributes']:_0x28ce4c[_0xe1ba('0x3f')];_0x31d96b[_0xe1ba('0x42')]=qs[_0xe1ba('0x43')](_0x322d51[_0xe1ba('0x3b')][_0xe1ba('0x43')]);_0x31d96b[_0xe1ba('0x44')]=qs[_0xe1ba('0x3d')](_[_0xe1ba('0x45')](_0x322d51[_0xe1ba('0x3b')],_0x28ce4c[_0xe1ba('0x3d')]));if(_0x322d51[_0xe1ba('0x3b')][_0xe1ba('0x46')]){_0x31d96b['where']=_[_0xe1ba('0x47')](_0x31d96b['where'],{'$or':_[_0xe1ba('0x48')](_0x31d96b[_0xe1ba('0x4f')],function(_0x1b4c49){var _0x45c7c5={};_0x45c7c5[_0x1b4c49]={'$like':'%'+_0x322d51['query'][_0xe1ba('0x46')]+'%'};return _0x45c7c5;})});}_0x31d96b=_[_0xe1ba('0x47')]({},_0x31d96b,_0x322d51[_0xe1ba('0x57')]);return _0x1b99fe['getTags'](_0x31d96b);}})['then'](function(_0xdce5be){if(_0xdce5be){_0x17ba72=_0xdce5be[_0xe1ba('0x50')];if(!_0x322d51[_0xe1ba('0x3b')]['hasOwnProperty'](_0xe1ba('0x59'))){_0x31d96b[_0xe1ba('0x30')]=qs['limit'](_0x322d51[_0xe1ba('0x3b')][_0xe1ba('0x30')]);_0x31d96b['offset']=qs['offset'](_0x322d51['query']['offset']);}return _0x1b99fe[_0xe1ba('0x5c')](_0x31d96b);}})[_0xe1ba('0x1f')](function(_0xe25a23){if(_0xe25a23){return _0xe25a23?{'count':_0x17ba72,'rows':_0xe25a23}:null;}})['then'](respondWithResult(_0x8b3a01,null))[_0xe1ba('0x2a')](handleError(_0x8b3a01,null));};exports[_0xe1ba('0x5e')]=function(_0xa9df10,_0x48fbc9,_0x4ad228){if(_0xa9df10[_0xe1ba('0x54')]['id']){delete _0xa9df10[_0xe1ba('0x54')]['id'];}return db[_0xe1ba('0x37')][_0xe1ba('0x55')]({'where':{'id':_0xa9df10[_0xe1ba('0x4e')]['id']}})[_0xe1ba('0x1f')](handleEntityNotFound(_0x48fbc9,null))[_0xe1ba('0x1f')](function(_0x248adf){if(_0x248adf){return _0x248adf[_0xe1ba('0x5e')](_0xa9df10[_0xe1ba('0x54')][_0xe1ba('0x5f')]||[]);}return null;})[_0xe1ba('0x1f')](respondWithResult(_0x48fbc9,null))[_0xe1ba('0x2a')](handleError(_0x48fbc9,null));};
\ No newline at end of file
+var _0xb4d8=['options','getSubjects','hasOwnProperty','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','apply','save','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','catch','length','find','create','body','params','findOne','ZendeskField','order'];(function(_0x45e765,_0x3eac85){var _0x1d5efb=function(_0x452994){while(--_0x452994){_0x45e765['push'](_0x45e765['shift']());}};_0x1d5efb(++_0x3eac85);}(_0xb4d8,0x1ed));var _0x8b4d=function(_0x53be90,_0x2687b9){_0x53be90=_0x53be90-0x0;var _0x55c47d=_0xb4d8[_0x53be90];return _0x55c47d;};'use strict';var emlformat=require(_0x8b4d('0x0'));var rimraf=require(_0x8b4d('0x1'));var zipdir=require(_0x8b4d('0x2'));var jsonpatch=require(_0x8b4d('0x3'));var rp=require(_0x8b4d('0x4'));var moment=require(_0x8b4d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8b4d('0x6'));var path=require(_0x8b4d('0x7'));var sox=require(_0x8b4d('0x8'));var csv=require(_0x8b4d('0x9'));var ejs=require(_0x8b4d('0xa'));var fs=require('fs');var fs_extra=require(_0x8b4d('0xb'));var _=require(_0x8b4d('0xc'));var squel=require(_0x8b4d('0xd'));var crypto=require(_0x8b4d('0xe'));var jsforce=require(_0x8b4d('0xf'));var deskjs=require(_0x8b4d('0x10'));var toCsv=require(_0x8b4d('0x9'));var querystring=require(_0x8b4d('0x11'));var Papa=require('papaparse');var Redis=require(_0x8b4d('0x12'));var authService=require(_0x8b4d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8b4d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b4d('0x15'))(_0x8b4d('0x16'));var utils=require('../../config/utils');var config=require(_0x8b4d('0x17'));var licenseUtil=require(_0x8b4d('0x18'));var db=require(_0x8b4d('0x19'))['db'];function respondWithStatusCode(_0x15fd3a,_0x193ab8){_0x193ab8=_0x193ab8||0xcc;return function(_0x3e896a){if(_0x3e896a){return _0x15fd3a[_0x8b4d('0x1a')](_0x193ab8);}return _0x15fd3a[_0x8b4d('0x1b')](_0x193ab8)['end']();};}function respondWithResult(_0x2c36c1,_0x5587f4){_0x5587f4=_0x5587f4||0xc8;return function(_0x2cfef8){if(_0x2cfef8){return _0x2c36c1[_0x8b4d('0x1b')](_0x5587f4)['json'](_0x2cfef8);}};}function respondWithFilteredResult(_0x53b4c5,_0x31e18f){return function(_0x33e066){if(_0x33e066){var _0x52010b=typeof _0x31e18f['offset']===_0x8b4d('0x1c')&&typeof _0x31e18f[_0x8b4d('0x1d')]===_0x8b4d('0x1c');var _0xea9b8c=_0x33e066[_0x8b4d('0x1e')];var _0x134a1c=_0x52010b?0x0:_0x31e18f[_0x8b4d('0x1f')];var _0x549f0c=_0x52010b?_0x33e066[_0x8b4d('0x1e')]:_0x31e18f[_0x8b4d('0x1f')]+_0x31e18f[_0x8b4d('0x1d')];var _0xd3be9d;if(_0x549f0c>=_0xea9b8c){_0x549f0c=_0xea9b8c;_0xd3be9d=0xc8;}else{_0xd3be9d=0xce;}_0x53b4c5['status'](_0xd3be9d);return _0x53b4c5['set']('Content-Range',_0x134a1c+'-'+_0x549f0c+'/'+_0xea9b8c)['json'](_0x33e066);}return null;};}function patchUpdates(_0x22ebdd){return function(_0x5a5128){try{jsonpatch[_0x8b4d('0x20')](_0x5a5128,_0x22ebdd,!![]);}catch(_0xc5ea31){return BPromise['reject'](_0xc5ea31);}return _0x5a5128[_0x8b4d('0x21')]();};}function saveUpdates(_0xdfd356,_0x2fa37c){return function(_0x210933){if(_0x210933){return _0x210933[_0x8b4d('0x22')](_0xdfd356)[_0x8b4d('0x23')](function(_0x50b641){return _0x50b641;});}return null;};}function removeEntity(_0x439c00,_0x2e48d4){return function(_0x5b0e54){if(_0x5b0e54){return _0x5b0e54[_0x8b4d('0x24')]()[_0x8b4d('0x23')](function(){_0x439c00[_0x8b4d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90214a,_0x6c4f31){return function(_0x1b7fc7){if(!_0x1b7fc7){_0x90214a[_0x8b4d('0x1a')](0x194);}return _0x1b7fc7;};}function handleError(_0x48fe97,_0x1c3d2b){_0x1c3d2b=_0x1c3d2b||0x1f4;return function(_0x5570d0){logger[_0x8b4d('0x25')](_0x5570d0[_0x8b4d('0x26')]);if(_0x5570d0[_0x8b4d('0x27')]){delete _0x5570d0[_0x8b4d('0x27')];}_0x48fe97[_0x8b4d('0x1b')](_0x1c3d2b)[_0x8b4d('0x28')](_0x5570d0);};}exports[_0x8b4d('0x29')]=function(_0x1ae746,_0x35008b){var _0x496414={},_0x1217c5={},_0x37a077={'count':0x0,'rows':[]};var _0x88b208=_[_0x8b4d('0x2a')](db[_0x8b4d('0x2b')][_0x8b4d('0x2c')],function(_0x7639fd){return{'name':_0x7639fd[_0x8b4d('0x2d')],'type':_0x7639fd['type'][_0x8b4d('0x2e')]};});_0x1217c5['model']=_[_0x8b4d('0x2a')](_0x88b208,_0x8b4d('0x27'));_0x1217c5['query']=_[_0x8b4d('0x2f')](_0x1ae746[_0x8b4d('0x30')]);_0x1217c5[_0x8b4d('0x31')]=_[_0x8b4d('0x32')](_0x1217c5[_0x8b4d('0x33')],_0x1217c5[_0x8b4d('0x30')]);_0x496414[_0x8b4d('0x34')]=_['intersection'](_0x1217c5['model'],qs[_0x8b4d('0x35')](_0x1ae746[_0x8b4d('0x30')]['fields']));_0x496414[_0x8b4d('0x34')]=_0x496414[_0x8b4d('0x34')]['length']?_0x496414[_0x8b4d('0x34')]:_0x1217c5['model'];if(!_0x1ae746[_0x8b4d('0x30')]['hasOwnProperty'](_0x8b4d('0x36'))){_0x496414[_0x8b4d('0x1d')]=qs[_0x8b4d('0x1d')](_0x1ae746[_0x8b4d('0x30')]['limit']);_0x496414[_0x8b4d('0x1f')]=qs[_0x8b4d('0x1f')](_0x1ae746[_0x8b4d('0x30')][_0x8b4d('0x1f')]);}_0x496414['order']=qs['sort'](_0x1ae746[_0x8b4d('0x30')][_0x8b4d('0x37')]);_0x496414['where']=qs['filters'](_[_0x8b4d('0x38')](_0x1ae746[_0x8b4d('0x30')],_0x1217c5['filters']),_0x88b208);if(_0x1ae746[_0x8b4d('0x30')][_0x8b4d('0x39')]){_0x496414['where']=_[_0x8b4d('0x3a')](_0x496414[_0x8b4d('0x3b')],{'$or':_[_0x8b4d('0x2a')](_0x88b208,function(_0xb80e06){if(_0xb80e06[_0x8b4d('0x3c')]!==_0x8b4d('0x3d')){var _0xa100e1={};_0xa100e1[_0xb80e06['name']]={'$like':'%'+_0x1ae746['query'][_0x8b4d('0x39')]+'%'};return _0xa100e1;}})});}_0x496414=_[_0x8b4d('0x3a')]({},_0x496414,_0x1ae746['options']);var _0x1e2d36={'where':_0x496414[_0x8b4d('0x3b')]};return db['ZendeskConfiguration'][_0x8b4d('0x1e')](_0x1e2d36)[_0x8b4d('0x23')](function(_0x2647b0){_0x37a077[_0x8b4d('0x1e')]=_0x2647b0;if(_0x1ae746[_0x8b4d('0x30')][_0x8b4d('0x3e')]){_0x496414[_0x8b4d('0x3f')]=[{'all':!![]}];}return db[_0x8b4d('0x2b')][_0x8b4d('0x40')](_0x496414);})[_0x8b4d('0x23')](function(_0x4c1398){_0x37a077['rows']=_0x4c1398;return _0x37a077;})[_0x8b4d('0x23')](respondWithFilteredResult(_0x35008b,_0x496414))[_0x8b4d('0x41')](handleError(_0x35008b,null));};exports['show']=function(_0x1d2949,_0x2db6fd){var _0x5ce3b9={'raw':![],'where':{'id':_0x1d2949['params']['id']}},_0x164d84={};_0x164d84[_0x8b4d('0x33')]=_['keys'](db[_0x8b4d('0x2b')][_0x8b4d('0x2c')]);_0x164d84[_0x8b4d('0x30')]=_[_0x8b4d('0x2f')](_0x1d2949[_0x8b4d('0x30')]);_0x164d84[_0x8b4d('0x31')]=_['intersection'](_0x164d84[_0x8b4d('0x33')],_0x164d84['query']);_0x5ce3b9[_0x8b4d('0x34')]=_[_0x8b4d('0x32')](_0x164d84[_0x8b4d('0x33')],qs[_0x8b4d('0x35')](_0x1d2949[_0x8b4d('0x30')]['fields']));_0x5ce3b9['attributes']=_0x5ce3b9['attributes'][_0x8b4d('0x42')]?_0x5ce3b9[_0x8b4d('0x34')]:_0x164d84[_0x8b4d('0x33')];if(_0x1d2949[_0x8b4d('0x30')][_0x8b4d('0x3e')]){_0x5ce3b9['include']=[{'all':!![]}];}_0x5ce3b9=_[_0x8b4d('0x3a')]({},_0x5ce3b9,_0x1d2949['options']);return db[_0x8b4d('0x2b')][_0x8b4d('0x43')](_0x5ce3b9)[_0x8b4d('0x23')](handleEntityNotFound(_0x2db6fd,null))[_0x8b4d('0x23')](respondWithResult(_0x2db6fd,null))[_0x8b4d('0x41')](handleError(_0x2db6fd,null));};exports[_0x8b4d('0x44')]=function(_0xe8759c,_0x4b959c){return db['ZendeskConfiguration']['create'](_0xe8759c[_0x8b4d('0x45')],{})['then'](respondWithResult(_0x4b959c,0xc9))['catch'](handleError(_0x4b959c,null));};exports[_0x8b4d('0x22')]=function(_0x144e69,_0x2dfa39){if(_0x144e69[_0x8b4d('0x45')]['id']){delete _0x144e69['body']['id'];}return db['ZendeskConfiguration'][_0x8b4d('0x43')]({'where':{'id':_0x144e69[_0x8b4d('0x46')]['id']}})['then'](handleEntityNotFound(_0x2dfa39,null))[_0x8b4d('0x23')](saveUpdates(_0x144e69[_0x8b4d('0x45')],null))[_0x8b4d('0x23')](respondWithResult(_0x2dfa39,null))[_0x8b4d('0x41')](handleError(_0x2dfa39,null));};exports['destroy']=function(_0x385614,_0x2dfefb){return db[_0x8b4d('0x2b')][_0x8b4d('0x43')]({'where':{'id':_0x385614[_0x8b4d('0x46')]['id']}})[_0x8b4d('0x23')](handleEntityNotFound(_0x2dfefb,null))[_0x8b4d('0x23')](removeEntity(_0x2dfefb,null))['catch'](handleError(_0x2dfefb,null));};exports['getFields']=function(_0x395088,_0x1e4ffe,_0x4a1ffd){var _0x224d18={};var _0x3b9117={};var _0x498169;var _0xa4798c;return db[_0x8b4d('0x2b')][_0x8b4d('0x47')]({'where':{'id':_0x395088[_0x8b4d('0x46')]['id']}})[_0x8b4d('0x23')](handleEntityNotFound(_0x1e4ffe,null))[_0x8b4d('0x23')](function(_0x1618aa){if(_0x1618aa){_0x498169=_0x1618aa;_0x3b9117[_0x8b4d('0x33')]=_[_0x8b4d('0x2f')](db[_0x8b4d('0x48')]['rawAttributes']);_0x3b9117[_0x8b4d('0x30')]=_['keys'](_0x395088[_0x8b4d('0x30')]);_0x3b9117[_0x8b4d('0x31')]=_[_0x8b4d('0x32')](_0x3b9117['model'],_0x3b9117[_0x8b4d('0x30')]);_0x224d18[_0x8b4d('0x34')]=_[_0x8b4d('0x32')](_0x3b9117['model'],qs[_0x8b4d('0x35')](_0x395088[_0x8b4d('0x30')]['fields']));_0x224d18['attributes']=_0x224d18[_0x8b4d('0x34')][_0x8b4d('0x42')]?_0x224d18[_0x8b4d('0x34')]:_0x3b9117[_0x8b4d('0x33')];_0x224d18[_0x8b4d('0x49')]=qs[_0x8b4d('0x37')](_0x395088['query'][_0x8b4d('0x37')]);_0x224d18[_0x8b4d('0x3b')]=qs[_0x8b4d('0x31')](_[_0x8b4d('0x38')](_0x395088[_0x8b4d('0x30')],_0x3b9117[_0x8b4d('0x31')]));if(_0x395088[_0x8b4d('0x30')][_0x8b4d('0x39')]){_0x224d18['where']=_['merge'](_0x224d18[_0x8b4d('0x3b')],{'$or':_[_0x8b4d('0x2a')](_0x224d18[_0x8b4d('0x34')],function(_0x488346){var _0x202a5d={};_0x202a5d[_0x488346]={'$like':'%'+_0x395088[_0x8b4d('0x30')][_0x8b4d('0x39')]+'%'};return _0x202a5d;})});}_0x224d18=_[_0x8b4d('0x3a')]({},_0x224d18,_0x395088[_0x8b4d('0x4a')]);return _0x498169['getFields'](_0x224d18);}})[_0x8b4d('0x23')](function(_0x5d0ab9){if(_0x5d0ab9){_0xa4798c=_0x5d0ab9[_0x8b4d('0x42')];if(!_0x395088[_0x8b4d('0x30')]['hasOwnProperty']('nolimit')){_0x224d18[_0x8b4d('0x1d')]=qs[_0x8b4d('0x1d')](_0x395088[_0x8b4d('0x30')][_0x8b4d('0x1d')]);_0x224d18[_0x8b4d('0x1f')]=qs[_0x8b4d('0x1f')](_0x395088[_0x8b4d('0x30')]['offset']);}return _0x498169['getFields'](_0x224d18);}})[_0x8b4d('0x23')](function(_0x516a68){if(_0x516a68){return _0x516a68?{'count':_0xa4798c,'rows':_0x516a68}:null;}})['then'](respondWithResult(_0x1e4ffe,null))['catch'](handleError(_0x1e4ffe,null));};exports[_0x8b4d('0x4b')]=function(_0x8086aa,_0x2e08ad,_0x36d1bd){var _0x390b63={};var _0x5833dd={};var _0x45d9b3;var _0x65704c;return db[_0x8b4d('0x2b')][_0x8b4d('0x47')]({'where':{'id':_0x8086aa[_0x8b4d('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e08ad,null))[_0x8b4d('0x23')](function(_0x3143c6){if(_0x3143c6){_0x45d9b3=_0x3143c6;_0x5833dd[_0x8b4d('0x33')]=_['keys'](db['ZendeskField'][_0x8b4d('0x2c')]);_0x5833dd[_0x8b4d('0x30')]=_['keys'](_0x8086aa[_0x8b4d('0x30')]);_0x5833dd[_0x8b4d('0x31')]=_['intersection'](_0x5833dd['model'],_0x5833dd[_0x8b4d('0x30')]);_0x390b63[_0x8b4d('0x34')]=_[_0x8b4d('0x32')](_0x5833dd[_0x8b4d('0x33')],qs[_0x8b4d('0x35')](_0x8086aa[_0x8b4d('0x30')][_0x8b4d('0x35')]));_0x390b63[_0x8b4d('0x34')]=_0x390b63['attributes'][_0x8b4d('0x42')]?_0x390b63['attributes']:_0x5833dd[_0x8b4d('0x33')];_0x390b63[_0x8b4d('0x49')]=qs[_0x8b4d('0x37')](_0x8086aa[_0x8b4d('0x30')][_0x8b4d('0x37')]);_0x390b63[_0x8b4d('0x3b')]=qs['filters'](_[_0x8b4d('0x38')](_0x8086aa[_0x8b4d('0x30')],_0x5833dd['filters']));if(_0x8086aa[_0x8b4d('0x30')][_0x8b4d('0x39')]){_0x390b63[_0x8b4d('0x3b')]=_[_0x8b4d('0x3a')](_0x390b63['where'],{'$or':_[_0x8b4d('0x2a')](_0x390b63['attributes'],function(_0x40caa5){var _0x2e46ff={};_0x2e46ff[_0x40caa5]={'$like':'%'+_0x8086aa[_0x8b4d('0x30')][_0x8b4d('0x39')]+'%'};return _0x2e46ff;})});}_0x390b63=_[_0x8b4d('0x3a')]({},_0x390b63,_0x8086aa[_0x8b4d('0x4a')]);return _0x45d9b3[_0x8b4d('0x4b')](_0x390b63);}})[_0x8b4d('0x23')](function(_0x5ec4a3){if(_0x5ec4a3){_0x65704c=_0x5ec4a3[_0x8b4d('0x42')];if(!_0x8086aa[_0x8b4d('0x30')][_0x8b4d('0x4c')]('nolimit')){_0x390b63[_0x8b4d('0x1d')]=qs['limit'](_0x8086aa[_0x8b4d('0x30')][_0x8b4d('0x1d')]);_0x390b63[_0x8b4d('0x1f')]=qs[_0x8b4d('0x1f')](_0x8086aa[_0x8b4d('0x30')]['offset']);}return _0x45d9b3[_0x8b4d('0x4b')](_0x390b63);}})[_0x8b4d('0x23')](function(_0x44abc6){if(_0x44abc6){return _0x44abc6?{'count':_0x65704c,'rows':_0x44abc6}:null;}})[_0x8b4d('0x23')](respondWithResult(_0x2e08ad,null))['catch'](handleError(_0x2e08ad,null));};exports[_0x8b4d('0x4d')]=function(_0x146b83,_0x1ac6ed,_0x4fb947){var _0x175fdf={};var _0x11dbd7={};var _0x1b4970;var _0x1fd820;return db['ZendeskConfiguration'][_0x8b4d('0x47')]({'where':{'id':_0x146b83[_0x8b4d('0x46')]['id']}})[_0x8b4d('0x23')](handleEntityNotFound(_0x1ac6ed,null))['then'](function(_0x3f9fa4){if(_0x3f9fa4){_0x1b4970=_0x3f9fa4;_0x11dbd7[_0x8b4d('0x33')]=_[_0x8b4d('0x2f')](db['ZendeskField'][_0x8b4d('0x2c')]);_0x11dbd7[_0x8b4d('0x30')]=_['keys'](_0x146b83[_0x8b4d('0x30')]);_0x11dbd7[_0x8b4d('0x31')]=_[_0x8b4d('0x32')](_0x11dbd7['model'],_0x11dbd7[_0x8b4d('0x30')]);_0x175fdf['attributes']=_[_0x8b4d('0x32')](_0x11dbd7[_0x8b4d('0x33')],qs[_0x8b4d('0x35')](_0x146b83[_0x8b4d('0x30')]['fields']));_0x175fdf[_0x8b4d('0x34')]=_0x175fdf[_0x8b4d('0x34')][_0x8b4d('0x42')]?_0x175fdf['attributes']:_0x11dbd7[_0x8b4d('0x33')];_0x175fdf[_0x8b4d('0x49')]=qs[_0x8b4d('0x37')](_0x146b83[_0x8b4d('0x30')][_0x8b4d('0x37')]);_0x175fdf['where']=qs['filters'](_[_0x8b4d('0x38')](_0x146b83[_0x8b4d('0x30')],_0x11dbd7[_0x8b4d('0x31')]));if(_0x146b83['query'][_0x8b4d('0x39')]){_0x175fdf[_0x8b4d('0x3b')]=_[_0x8b4d('0x3a')](_0x175fdf[_0x8b4d('0x3b')],{'$or':_['map'](_0x175fdf[_0x8b4d('0x34')],function(_0x15b6be){var _0x28e37e={};_0x28e37e[_0x15b6be]={'$like':'%'+_0x146b83[_0x8b4d('0x30')][_0x8b4d('0x39')]+'%'};return _0x28e37e;})});}_0x175fdf=_[_0x8b4d('0x3a')]({},_0x175fdf,_0x146b83['options']);return _0x1b4970[_0x8b4d('0x4d')](_0x175fdf);}})[_0x8b4d('0x23')](function(_0x360226){if(_0x360226){_0x1fd820=_0x360226[_0x8b4d('0x42')];if(!_0x146b83[_0x8b4d('0x30')][_0x8b4d('0x4c')](_0x8b4d('0x36'))){_0x175fdf[_0x8b4d('0x1d')]=qs['limit'](_0x146b83[_0x8b4d('0x30')]['limit']);_0x175fdf[_0x8b4d('0x1f')]=qs[_0x8b4d('0x1f')](_0x146b83[_0x8b4d('0x30')][_0x8b4d('0x1f')]);}return _0x1b4970[_0x8b4d('0x4d')](_0x175fdf);}})[_0x8b4d('0x23')](function(_0x507e9f){if(_0x507e9f){return _0x507e9f?{'count':_0x1fd820,'rows':_0x507e9f}:null;}})[_0x8b4d('0x23')](respondWithResult(_0x1ac6ed,null))[_0x8b4d('0x41')](handleError(_0x1ac6ed,null));};exports['getTags']=function(_0x5cd189,_0x37903c,_0x3ebd34){var _0x3d10f7={};var _0x4f58f3={};var _0x136d84;var _0xeccec2;return db[_0x8b4d('0x2b')][_0x8b4d('0x47')]({'where':{'id':_0x5cd189[_0x8b4d('0x46')]['id']}})[_0x8b4d('0x23')](handleEntityNotFound(_0x37903c,null))['then'](function(_0x28c8e3){if(_0x28c8e3){_0x136d84=_0x28c8e3;_0x4f58f3[_0x8b4d('0x33')]=_[_0x8b4d('0x2f')](db['Tag'][_0x8b4d('0x2c')]);_0x4f58f3[_0x8b4d('0x30')]=_[_0x8b4d('0x2f')](_0x5cd189[_0x8b4d('0x30')]);_0x4f58f3[_0x8b4d('0x31')]=_[_0x8b4d('0x32')](_0x4f58f3['model'],_0x4f58f3['query']);_0x3d10f7['attributes']=_[_0x8b4d('0x32')](_0x4f58f3[_0x8b4d('0x33')],qs[_0x8b4d('0x35')](_0x5cd189[_0x8b4d('0x30')][_0x8b4d('0x35')]));_0x3d10f7[_0x8b4d('0x34')]=_0x3d10f7[_0x8b4d('0x34')]['length']?_0x3d10f7['attributes']:_0x4f58f3[_0x8b4d('0x33')];_0x3d10f7['order']=qs['sort'](_0x5cd189[_0x8b4d('0x30')][_0x8b4d('0x37')]);_0x3d10f7[_0x8b4d('0x3b')]=qs['filters'](_[_0x8b4d('0x38')](_0x5cd189[_0x8b4d('0x30')],_0x4f58f3[_0x8b4d('0x31')]));if(_0x5cd189['query']['filter']){_0x3d10f7['where']=_[_0x8b4d('0x3a')](_0x3d10f7[_0x8b4d('0x3b')],{'$or':_[_0x8b4d('0x2a')](_0x3d10f7[_0x8b4d('0x34')],function(_0x327e9b){var _0xdc2bc6={};_0xdc2bc6[_0x327e9b]={'$like':'%'+_0x5cd189[_0x8b4d('0x30')][_0x8b4d('0x39')]+'%'};return _0xdc2bc6;})});}_0x3d10f7=_[_0x8b4d('0x3a')]({},_0x3d10f7,_0x5cd189[_0x8b4d('0x4a')]);return _0x136d84[_0x8b4d('0x4e')](_0x3d10f7);}})['then'](function(_0x184a6f){if(_0x184a6f){_0xeccec2=_0x184a6f[_0x8b4d('0x42')];if(!_0x5cd189[_0x8b4d('0x30')][_0x8b4d('0x4c')](_0x8b4d('0x36'))){_0x3d10f7[_0x8b4d('0x1d')]=qs[_0x8b4d('0x1d')](_0x5cd189[_0x8b4d('0x30')][_0x8b4d('0x1d')]);_0x3d10f7[_0x8b4d('0x1f')]=qs['offset'](_0x5cd189[_0x8b4d('0x30')][_0x8b4d('0x1f')]);}return _0x136d84[_0x8b4d('0x4e')](_0x3d10f7);}})[_0x8b4d('0x23')](function(_0x3b5a16){if(_0x3b5a16){return _0x3b5a16?{'count':_0xeccec2,'rows':_0x3b5a16}:null;}})[_0x8b4d('0x23')](respondWithResult(_0x37903c,null))[_0x8b4d('0x41')](handleError(_0x37903c,null));};exports['setTags']=function(_0xe92507,_0x4e546d,_0x589e4e){if(_0xe92507[_0x8b4d('0x45')]['id']){delete _0xe92507[_0x8b4d('0x45')]['id'];}return db['ZendeskConfiguration'][_0x8b4d('0x47')]({'where':{'id':_0xe92507[_0x8b4d('0x46')]['id']}})[_0x8b4d('0x23')](handleEntityNotFound(_0x4e546d,null))[_0x8b4d('0x23')](function(_0x136ae6){if(_0x136ae6){return _0x136ae6[_0x8b4d('0x4f')](_0xe92507[_0x8b4d('0x45')][_0x8b4d('0x50')]||[]);}return null;})[_0x8b4d('0x23')](respondWithResult(_0x4e546d,null))['catch'](handleError(_0x4e546d,null));};
\ No newline at end of file