Built motion from commit c116dc8b.|2.6.30
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index 495ea3d..b8252c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['VIRTUAL','filter','ZendeskConfiguration','count','includeAll','include','findAll','rows','show','params','options','find','create','body','destroy','getFields','findOne','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','Tag','getTags','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','client','http','test','ValidationError','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge'];(function(_0xcf765a,_0x3fc2fb){var _0x4153d1=function(_0x29fd4f){while(--_0x29fd4f){_0xcf765a['push'](_0xcf765a['shift']());}};_0x4153d1(++_0x3fc2fb);}(_0x326f,0xd1));var _0xf326=function(_0x30a5a1,_0x196dd8){_0x30a5a1=_0x30a5a1-0x0;var _0x39419e=_0x326f[_0x30a5a1];return _0x39419e;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var db=require(_0xf326('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf326('0x17')][_0xf326('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4b3966,_0x342fe5,_0x472632){if(_0x472632){var _0x3504eb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3504eb[_0xf326('0x19')](_0x342fe5)){return _0x4b3966;}else{throw new db['Sequelize'][(_0xf326('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4b3966;}}function respondWithRpcPromise(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a){return new BPromise(function(_0xa63d1a,_0x292f4b){var _0x287a2a=_0x1f2e5a||client;return _0x287a2a[_0xf326('0x1b')](_0x54bd1a,_0x11f6d2)[_0xf326('0x1c')](function(_0x5a682a){logger[_0xf326('0x1d')](_0xf326('0x1e'),_0xdf21d9,_0xf326('0x1f'));logger[_0xf326('0x20')](_0xf326('0x21'),_0xdf21d9,_0xf326('0x1f'),JSON['stringify'](_0x5a682a));if(_0x5a682a['error']){if(_0x5a682a['error'][_0xf326('0x22')]===0x1f4){logger[_0xf326('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0xdf21d9,_0x5a682a['error'][_0xf326('0x24')]);return _0x292f4b(_0x5a682a['error']['message']);}logger[_0xf326('0x23')](_0xf326('0x1e'),_0xdf21d9,_0x5a682a['error']['message']);return _0xa63d1a(_0x5a682a[_0xf326('0x23')][_0xf326('0x24')]);}else{logger['info'](_0xf326('0x1e'),_0xdf21d9,_0xf326('0x1f'));_0xa63d1a(_0x5a682a[_0xf326('0x25')][_0xf326('0x24')]);}})[_0xf326('0x26')](function(_0x2049ec){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0xdf21d9,_0x2049ec);_0x292f4b(_0x2049ec);});});}function respondWithStatusCode(_0x4f31f6,_0x520d85){_0x520d85=_0x520d85||0xcc;return function(_0x1a2c4e){if(_0x1a2c4e){return _0x4f31f6[_0xf326('0x27')](_0x520d85);}return _0x4f31f6[_0xf326('0x28')](_0x520d85)[_0xf326('0x29')]();};}function respondWithResult(_0x410237,_0x5217d4){_0x5217d4=_0x5217d4||0xc8;return function(_0x201d28){if(_0x201d28){return _0x410237[_0xf326('0x28')](_0x5217d4)[_0xf326('0x2a')](_0x201d28);}};}function respondWithFilteredResult(_0x581531,_0x1617d2){return function(_0x55ad0f){if(_0x55ad0f){var _0x4a9abf=_0x55ad0f['count'],_0x6a8e89=_0x1617d2[_0xf326('0x2b')],_0x1ae23a=_0x1617d2[_0xf326('0x2b')]+_0x1617d2['limit'],_0x2fa28e;if(_0x1ae23a>=_0x4a9abf){_0x1ae23a=_0x4a9abf;_0x2fa28e=0xc8;}else{_0x2fa28e=0xce;}_0x581531[_0xf326('0x28')](_0x2fa28e);return _0x581531[_0xf326('0x2c')](_0xf326('0x2d'),_0x6a8e89+'-'+_0x1ae23a+'/'+_0x4a9abf)[_0xf326('0x2a')](_0x55ad0f);}return null;};}function patchUpdates(_0xa80156){return function(_0x269be9){try{jsonpatch[_0xf326('0x2e')](_0x269be9,_0xa80156,!![]);}catch(_0x39a1e2){return BPromise[_0xf326('0x2f')](_0x39a1e2);}return _0x269be9[_0xf326('0x30')]();};}function saveUpdates(_0x4b52f2,_0x1035ed){return function(_0x424104){if(_0x424104){return _0x424104[_0xf326('0x31')](_0x4b52f2)['then'](function(_0x2c0cac){return _0x2c0cac;});}return null;};}function removeEntity(_0x1721fd,_0x303dc6){return function(_0x4df451){if(_0x4df451){return _0x4df451['destroy']()[_0xf326('0x1c')](function(){_0x1721fd[_0xf326('0x28')](0xcc)[_0xf326('0x29')]();});}};}function handleEntityNotFound(_0xf53cf3,_0x30694f){return function(_0x2e8a64){if(!_0x2e8a64){_0xf53cf3[_0xf326('0x27')](0x194);}return _0x2e8a64;};}function handleError(_0x2d5f20,_0x580374){_0x580374=_0x580374||0x1f4;return function(_0x461e93){logger[_0xf326('0x23')](_0x461e93['stack']);if(_0x461e93[_0xf326('0x32')]){delete _0x461e93['name'];}_0x2d5f20[_0xf326('0x28')](_0x580374)['send'](_0x461e93);};}exports['index']=function(_0xadb020,_0x4d8eac){var _0x40dcb4={},_0x57aa27={},_0x310dbb={'count':0x0,'rows':[]};var _0x409260=_[_0xf326('0x33')](db['ZendeskConfiguration'][_0xf326('0x34')],function(_0x4095e6){return{'name':_0x4095e6['fieldName'],'type':_0x4095e6[_0xf326('0x35')][_0xf326('0x36')]};});_0x57aa27[_0xf326('0x37')]=_[_0xf326('0x33')](_0x409260,'name');_0x57aa27[_0xf326('0x38')]=_[_0xf326('0x39')](_0xadb020[_0xf326('0x38')]);_0x57aa27[_0xf326('0x3a')]=_[_0xf326('0x3b')](_0x57aa27['model'],_0x57aa27[_0xf326('0x38')]);_0x40dcb4[_0xf326('0x3c')]=_['intersection'](_0x57aa27['model'],qs[_0xf326('0x3d')](_0xadb020['query']['fields']));_0x40dcb4[_0xf326('0x3c')]=_0x40dcb4['attributes'][_0xf326('0x3e')]?_0x40dcb4[_0xf326('0x3c')]:_0x57aa27[_0xf326('0x37')];if(!_0xadb020[_0xf326('0x38')]['hasOwnProperty'](_0xf326('0x3f'))){_0x40dcb4[_0xf326('0x40')]=qs[_0xf326('0x40')](_0xadb020[_0xf326('0x38')][_0xf326('0x40')]);_0x40dcb4[_0xf326('0x2b')]=qs[_0xf326('0x2b')](_0xadb020[_0xf326('0x38')][_0xf326('0x2b')]);}_0x40dcb4[_0xf326('0x41')]=qs[_0xf326('0x42')](_0xadb020[_0xf326('0x38')]['sort']);_0x40dcb4[_0xf326('0x43')]=qs[_0xf326('0x3a')](_[_0xf326('0x44')](_0xadb020[_0xf326('0x38')],_0x57aa27[_0xf326('0x3a')]));if(_0xadb020[_0xf326('0x38')]['filter']){_0x40dcb4[_0xf326('0x43')]=_[_0xf326('0x45')](_0x40dcb4['where'],{'$or':_[_0xf326('0x33')](_0x409260,function(_0x819bf6){if(_0x819bf6[_0xf326('0x35')]!==_0xf326('0x46')){var _0x427c34={};_0x427c34[_0x819bf6['name']]={'$like':'%'+_0xadb020['query'][_0xf326('0x47')]+'%'};return _0x427c34;}})});}_0x40dcb4=_[_0xf326('0x45')]({},_0x40dcb4,_0xadb020['options']);var _0x4bd865={'where':_0x40dcb4[_0xf326('0x43')]};return db[_0xf326('0x48')][_0xf326('0x49')](_0x4bd865)['then'](function(_0x301e65){_0x310dbb[_0xf326('0x49')]=_0x301e65;if(_0xadb020[_0xf326('0x38')][_0xf326('0x4a')]){_0x40dcb4[_0xf326('0x4b')]=[{'all':!![]}];}return db[_0xf326('0x48')][_0xf326('0x4c')](_0x40dcb4);})[_0xf326('0x1c')](function(_0x3df9a8){_0x310dbb[_0xf326('0x4d')]=_0x3df9a8;return _0x310dbb;})[_0xf326('0x1c')](respondWithFilteredResult(_0x4d8eac,_0x40dcb4))[_0xf326('0x26')](handleError(_0x4d8eac,null));};exports[_0xf326('0x4e')]=function(_0x395b1e,_0xeac1a1){var _0x59f9a7={'raw':![],'where':{'id':_0x395b1e[_0xf326('0x4f')]['id']}},_0x199f8b={};_0x199f8b[_0xf326('0x37')]=_[_0xf326('0x39')](db['ZendeskConfiguration'][_0xf326('0x34')]);_0x199f8b[_0xf326('0x38')]=_[_0xf326('0x39')](_0x395b1e[_0xf326('0x38')]);_0x199f8b['filters']=_[_0xf326('0x3b')](_0x199f8b[_0xf326('0x37')],_0x199f8b[_0xf326('0x38')]);_0x59f9a7[_0xf326('0x3c')]=_[_0xf326('0x3b')](_0x199f8b['model'],qs['fields'](_0x395b1e[_0xf326('0x38')][_0xf326('0x3d')]));_0x59f9a7[_0xf326('0x3c')]=_0x59f9a7['attributes'][_0xf326('0x3e')]?_0x59f9a7[_0xf326('0x3c')]:_0x199f8b[_0xf326('0x37')];if(_0x395b1e['query']['includeAll']){_0x59f9a7[_0xf326('0x4b')]=[{'all':!![]}];}_0x59f9a7=_['merge']({},_0x59f9a7,_0x395b1e[_0xf326('0x50')]);return db['ZendeskConfiguration'][_0xf326('0x51')](_0x59f9a7)[_0xf326('0x1c')](handleEntityNotFound(_0xeac1a1,null))[_0xf326('0x1c')](respondWithResult(_0xeac1a1,null))[_0xf326('0x26')](handleError(_0xeac1a1,null));};exports[_0xf326('0x52')]=function(_0x35d3c8,_0x7f7ece){return db['ZendeskConfiguration'][_0xf326('0x52')](_0x35d3c8[_0xf326('0x53')],{})[_0xf326('0x1c')](respondWithResult(_0x7f7ece,0xc9))['catch'](handleError(_0x7f7ece,null));};exports[_0xf326('0x31')]=function(_0x3a832f,_0x3b8635){if(_0x3a832f[_0xf326('0x53')]['id']){delete _0x3a832f[_0xf326('0x53')]['id'];}return db['ZendeskConfiguration'][_0xf326('0x51')]({'where':{'id':_0x3a832f[_0xf326('0x4f')]['id']}})[_0xf326('0x1c')](handleEntityNotFound(_0x3b8635,null))[_0xf326('0x1c')](saveUpdates(_0x3a832f['body'],null))[_0xf326('0x1c')](respondWithResult(_0x3b8635,null))[_0xf326('0x26')](handleError(_0x3b8635,null));};exports[_0xf326('0x54')]=function(_0x29e52e,_0x4d3b9e){return db['ZendeskConfiguration'][_0xf326('0x51')]({'where':{'id':_0x29e52e[_0xf326('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4d3b9e,null))[_0xf326('0x1c')](removeEntity(_0x4d3b9e,null))[_0xf326('0x26')](handleError(_0x4d3b9e,null));};exports[_0xf326('0x55')]=function(_0x1258d1,_0x5765b0,_0xb1c18c){var _0x5657b7={};var _0x5dbeb9={};var _0x9d84c3;var _0x51d466;return db[_0xf326('0x48')][_0xf326('0x56')]({'where':{'id':_0x1258d1[_0xf326('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5765b0,null))['then'](function(_0x1fd9c9){if(_0x1fd9c9){_0x9d84c3=_0x1fd9c9;_0x5dbeb9[_0xf326('0x37')]=_[_0xf326('0x39')](db['ZendeskField'][_0xf326('0x34')]);_0x5dbeb9['query']=_[_0xf326('0x39')](_0x1258d1[_0xf326('0x38')]);_0x5dbeb9[_0xf326('0x3a')]=_[_0xf326('0x3b')](_0x5dbeb9[_0xf326('0x37')],_0x5dbeb9[_0xf326('0x38')]);_0x5657b7[_0xf326('0x3c')]=_[_0xf326('0x3b')](_0x5dbeb9[_0xf326('0x37')],qs[_0xf326('0x3d')](_0x1258d1[_0xf326('0x38')][_0xf326('0x3d')]));_0x5657b7[_0xf326('0x3c')]=_0x5657b7['attributes'][_0xf326('0x3e')]?_0x5657b7['attributes']:_0x5dbeb9[_0xf326('0x37')];_0x5657b7[_0xf326('0x41')]=qs['sort'](_0x1258d1[_0xf326('0x38')]['sort']);_0x5657b7[_0xf326('0x43')]=qs[_0xf326('0x3a')](_[_0xf326('0x44')](_0x1258d1[_0xf326('0x38')],_0x5dbeb9[_0xf326('0x3a')]));if(_0x1258d1['query']['filter']){_0x5657b7[_0xf326('0x43')]=_[_0xf326('0x45')](_0x5657b7[_0xf326('0x43')],{'$or':_[_0xf326('0x33')](_0x5657b7[_0xf326('0x3c')],function(_0x579d2c){var _0x28c4f2={};_0x28c4f2[_0x579d2c]={'$like':'%'+_0x1258d1[_0xf326('0x38')]['filter']+'%'};return _0x28c4f2;})});}_0x5657b7=_['merge']({},_0x5657b7,_0x1258d1['options']);return _0x9d84c3[_0xf326('0x55')](_0x5657b7);}})[_0xf326('0x1c')](function(_0x4150fa){if(_0x4150fa){_0x51d466=_0x4150fa[_0xf326('0x3e')];if(!_0x1258d1[_0xf326('0x38')][_0xf326('0x57')](_0xf326('0x3f'))){_0x5657b7['limit']=qs[_0xf326('0x40')](_0x1258d1[_0xf326('0x38')][_0xf326('0x40')]);_0x5657b7[_0xf326('0x2b')]=qs['offset'](_0x1258d1[_0xf326('0x38')]['offset']);}return _0x9d84c3['getFields'](_0x5657b7);}})[_0xf326('0x1c')](function(_0x540fa0){if(_0x540fa0){return _0x540fa0?{'count':_0x51d466,'rows':_0x540fa0}:null;}})[_0xf326('0x1c')](respondWithResult(_0x5765b0,null))[_0xf326('0x26')](handleError(_0x5765b0,null));};exports[_0xf326('0x58')]=function(_0x2ea5a2,_0x17cd36,_0x541491){var _0x4a053c={};var _0x48d84a={};var _0xeeea57;var _0x307441;return db[_0xf326('0x48')][_0xf326('0x56')]({'where':{'id':_0x2ea5a2[_0xf326('0x4f')]['id']}})['then'](handleEntityNotFound(_0x17cd36,null))[_0xf326('0x1c')](function(_0x372dc8){if(_0x372dc8){_0xeeea57=_0x372dc8;_0x48d84a[_0xf326('0x37')]=_['keys'](db['ZendeskField'][_0xf326('0x34')]);_0x48d84a[_0xf326('0x38')]=_['keys'](_0x2ea5a2['query']);_0x48d84a[_0xf326('0x3a')]=_['intersection'](_0x48d84a[_0xf326('0x37')],_0x48d84a['query']);_0x4a053c['attributes']=_['intersection'](_0x48d84a[_0xf326('0x37')],qs[_0xf326('0x3d')](_0x2ea5a2[_0xf326('0x38')]['fields']));_0x4a053c[_0xf326('0x3c')]=_0x4a053c[_0xf326('0x3c')][_0xf326('0x3e')]?_0x4a053c[_0xf326('0x3c')]:_0x48d84a[_0xf326('0x37')];_0x4a053c[_0xf326('0x41')]=qs[_0xf326('0x42')](_0x2ea5a2[_0xf326('0x38')][_0xf326('0x42')]);_0x4a053c['where']=qs[_0xf326('0x3a')](_['pick'](_0x2ea5a2[_0xf326('0x38')],_0x48d84a[_0xf326('0x3a')]));if(_0x2ea5a2[_0xf326('0x38')]['filter']){_0x4a053c[_0xf326('0x43')]=_[_0xf326('0x45')](_0x4a053c[_0xf326('0x43')],{'$or':_['map'](_0x4a053c[_0xf326('0x3c')],function(_0x4057e1){var _0x3bbe4c={};_0x3bbe4c[_0x4057e1]={'$like':'%'+_0x2ea5a2[_0xf326('0x38')]['filter']+'%'};return _0x3bbe4c;})});}_0x4a053c=_[_0xf326('0x45')]({},_0x4a053c,_0x2ea5a2['options']);return _0xeeea57['getSubjects'](_0x4a053c);}})[_0xf326('0x1c')](function(_0x2c36d3){if(_0x2c36d3){_0x307441=_0x2c36d3['length'];if(!_0x2ea5a2['query']['hasOwnProperty'](_0xf326('0x3f'))){_0x4a053c['limit']=qs[_0xf326('0x40')](_0x2ea5a2[_0xf326('0x38')][_0xf326('0x40')]);_0x4a053c[_0xf326('0x2b')]=qs[_0xf326('0x2b')](_0x2ea5a2[_0xf326('0x38')]['offset']);}return _0xeeea57[_0xf326('0x58')](_0x4a053c);}})[_0xf326('0x1c')](function(_0x5f1724){if(_0x5f1724){return _0x5f1724?{'count':_0x307441,'rows':_0x5f1724}:null;}})['then'](respondWithResult(_0x17cd36,null))[_0xf326('0x26')](handleError(_0x17cd36,null));};exports['getDescriptions']=function(_0x35a7c9,_0x147d51,_0x153027){var _0x363e64={};var _0x19d676={};var _0x6e662;var _0x293600;return db[_0xf326('0x48')][_0xf326('0x56')]({'where':{'id':_0x35a7c9['params']['id']}})[_0xf326('0x1c')](handleEntityNotFound(_0x147d51,null))[_0xf326('0x1c')](function(_0x4ac90e){if(_0x4ac90e){_0x6e662=_0x4ac90e;_0x19d676[_0xf326('0x37')]=_['keys'](db[_0xf326('0x59')][_0xf326('0x34')]);_0x19d676[_0xf326('0x38')]=_['keys'](_0x35a7c9[_0xf326('0x38')]);_0x19d676[_0xf326('0x3a')]=_[_0xf326('0x3b')](_0x19d676[_0xf326('0x37')],_0x19d676[_0xf326('0x38')]);_0x363e64[_0xf326('0x3c')]=_[_0xf326('0x3b')](_0x19d676[_0xf326('0x37')],qs[_0xf326('0x3d')](_0x35a7c9[_0xf326('0x38')][_0xf326('0x3d')]));_0x363e64[_0xf326('0x3c')]=_0x363e64[_0xf326('0x3c')][_0xf326('0x3e')]?_0x363e64[_0xf326('0x3c')]:_0x19d676['model'];_0x363e64[_0xf326('0x41')]=qs[_0xf326('0x42')](_0x35a7c9['query'][_0xf326('0x42')]);_0x363e64[_0xf326('0x43')]=qs['filters'](_[_0xf326('0x44')](_0x35a7c9[_0xf326('0x38')],_0x19d676[_0xf326('0x3a')]));if(_0x35a7c9[_0xf326('0x38')][_0xf326('0x47')]){_0x363e64[_0xf326('0x43')]=_[_0xf326('0x45')](_0x363e64['where'],{'$or':_[_0xf326('0x33')](_0x363e64[_0xf326('0x3c')],function(_0x323fb1){var _0x3c33d1={};_0x3c33d1[_0x323fb1]={'$like':'%'+_0x35a7c9[_0xf326('0x38')][_0xf326('0x47')]+'%'};return _0x3c33d1;})});}_0x363e64=_[_0xf326('0x45')]({},_0x363e64,_0x35a7c9[_0xf326('0x50')]);return _0x6e662['getDescriptions'](_0x363e64);}})[_0xf326('0x1c')](function(_0x2e2103){if(_0x2e2103){_0x293600=_0x2e2103['length'];if(!_0x35a7c9[_0xf326('0x38')]['hasOwnProperty'](_0xf326('0x3f'))){_0x363e64[_0xf326('0x40')]=qs[_0xf326('0x40')](_0x35a7c9[_0xf326('0x38')][_0xf326('0x40')]);_0x363e64[_0xf326('0x2b')]=qs[_0xf326('0x2b')](_0x35a7c9[_0xf326('0x38')][_0xf326('0x2b')]);}return _0x6e662[_0xf326('0x5a')](_0x363e64);}})[_0xf326('0x1c')](function(_0x3face2){if(_0x3face2){return _0x3face2?{'count':_0x293600,'rows':_0x3face2}:null;}})[_0xf326('0x1c')](respondWithResult(_0x147d51,null))[_0xf326('0x26')](handleError(_0x147d51,null));};exports['getTags']=function(_0x2bb6f0,_0xdb6e40,_0x27c569){var _0x3d3bd4={};var _0xdb2ad8={};var _0x550f34;var _0x1ec128;return db[_0xf326('0x48')][_0xf326('0x56')]({'where':{'id':_0x2bb6f0[_0xf326('0x4f')]['id']}})[_0xf326('0x1c')](handleEntityNotFound(_0xdb6e40,null))['then'](function(_0x4b6ec0){if(_0x4b6ec0){_0x550f34=_0x4b6ec0;_0xdb2ad8[_0xf326('0x37')]=_['keys'](db[_0xf326('0x5b')][_0xf326('0x34')]);_0xdb2ad8[_0xf326('0x38')]=_['keys'](_0x2bb6f0['query']);_0xdb2ad8[_0xf326('0x3a')]=_[_0xf326('0x3b')](_0xdb2ad8[_0xf326('0x37')],_0xdb2ad8[_0xf326('0x38')]);_0x3d3bd4[_0xf326('0x3c')]=_['intersection'](_0xdb2ad8[_0xf326('0x37')],qs[_0xf326('0x3d')](_0x2bb6f0[_0xf326('0x38')]['fields']));_0x3d3bd4['attributes']=_0x3d3bd4['attributes'][_0xf326('0x3e')]?_0x3d3bd4[_0xf326('0x3c')]:_0xdb2ad8[_0xf326('0x37')];_0x3d3bd4[_0xf326('0x41')]=qs[_0xf326('0x42')](_0x2bb6f0[_0xf326('0x38')][_0xf326('0x42')]);_0x3d3bd4['where']=qs['filters'](_[_0xf326('0x44')](_0x2bb6f0[_0xf326('0x38')],_0xdb2ad8[_0xf326('0x3a')]));if(_0x2bb6f0['query'][_0xf326('0x47')]){_0x3d3bd4[_0xf326('0x43')]=_[_0xf326('0x45')](_0x3d3bd4['where'],{'$or':_[_0xf326('0x33')](_0x3d3bd4[_0xf326('0x3c')],function(_0x267bae){var _0x3d728a={};_0x3d728a[_0x267bae]={'$like':'%'+_0x2bb6f0['query']['filter']+'%'};return _0x3d728a;})});}_0x3d3bd4=_['merge']({},_0x3d3bd4,_0x2bb6f0[_0xf326('0x50')]);return _0x550f34[_0xf326('0x5c')](_0x3d3bd4);}})[_0xf326('0x1c')](function(_0x5f0b45){if(_0x5f0b45){_0x1ec128=_0x5f0b45[_0xf326('0x3e')];if(!_0x2bb6f0[_0xf326('0x38')][_0xf326('0x57')]('nolimit')){_0x3d3bd4[_0xf326('0x40')]=qs[_0xf326('0x40')](_0x2bb6f0[_0xf326('0x38')][_0xf326('0x40')]);_0x3d3bd4['offset']=qs[_0xf326('0x2b')](_0x2bb6f0['query'][_0xf326('0x2b')]);}return _0x550f34[_0xf326('0x5c')](_0x3d3bd4);}})[_0xf326('0x1c')](function(_0xd45708){if(_0xd45708){return _0xd45708?{'count':_0x1ec128,'rows':_0xd45708}:null;}})['then'](respondWithResult(_0xdb6e40,null))[_0xf326('0x26')](handleError(_0xdb6e40,null));};exports['setTags']=function(_0x499316,_0x1ec34d,_0x1d6962){if(_0x499316[_0xf326('0x53')]['id']){delete _0x499316[_0xf326('0x53')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x499316[_0xf326('0x4f')]['id']}})[_0xf326('0x1c')](handleEntityNotFound(_0x1ec34d,null))[_0xf326('0x1c')](function(_0xc67315){if(_0xc67315){return _0xc67315['setTags'](_0x499316[_0xf326('0x53')]['ids']||[]);}return null;})[_0xf326('0x1c')](respondWithResult(_0x1ec34d,null))[_0xf326('0x26')](handleError(_0x1ec34d,null));};
\ No newline at end of file
+var _0x79cb=['model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','map','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','find','create','body','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','ZendeskConfiguration','rawAttributes','fieldName','type','key'];(function(_0x5456ea,_0x3cde0c){var _0x1b0077=function(_0x2fad7a){while(--_0x2fad7a){_0x5456ea['push'](_0x5456ea['shift']());}};_0x1b0077(++_0x3cde0c);}(_0x79cb,0x16c));var _0xb79c=function(_0x563891,_0x2ce468){_0x563891=_0x563891-0x0;var _0x2e0167=_0x79cb[_0x563891];return _0x2e0167;};'use strict';var emlformat=require(_0xb79c('0x0'));var rimraf=require(_0xb79c('0x1'));var zipdir=require(_0xb79c('0x2'));var jsonpatch=require(_0xb79c('0x3'));var rp=require(_0xb79c('0x4'));var moment=require(_0xb79c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb79c('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb79c('0x7'));var csv=require(_0xb79c('0x8'));var ejs=require(_0xb79c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb79c('0xa'));var crypto=require(_0xb79c('0xb'));var jsforce=require(_0xb79c('0xc'));var deskjs=require(_0xb79c('0xd'));var toCsv=require(_0xb79c('0x8'));var querystring=require(_0xb79c('0xe'));var Papa=require('papaparse');var Redis=require(_0xb79c('0xf'));var authService=require(_0xb79c('0x10'));var qs=require(_0xb79c('0x11'));var as=require(_0xb79c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb79c('0x13'))(_0xb79c('0x14'));var utils=require(_0xb79c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb79c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x291b50,_0x551bc2){_0x551bc2=_0x551bc2||0xcc;return function(_0x29bb60){if(_0x29bb60){return _0x291b50[_0xb79c('0x17')](_0x551bc2);}return _0x291b50[_0xb79c('0x18')](_0x551bc2)['end']();};}function respondWithResult(_0x29ce59,_0x135136){_0x135136=_0x135136||0xc8;return function(_0xbc22e2){if(_0xbc22e2){return _0x29ce59['status'](_0x135136)[_0xb79c('0x19')](_0xbc22e2);}};}function respondWithFilteredResult(_0x2a252b,_0x114c5e){return function(_0x3ed0ca){if(_0x3ed0ca){var _0x123e02=typeof _0x114c5e[_0xb79c('0x1a')]===_0xb79c('0x1b')&&typeof _0x114c5e[_0xb79c('0x1c')]==='undefined';var _0x149cd8=_0x3ed0ca[_0xb79c('0x1d')];var _0x42831f=_0x123e02?0x0:_0x114c5e[_0xb79c('0x1a')];var _0x48255a=_0x123e02?_0x3ed0ca['count']:_0x114c5e[_0xb79c('0x1a')]+_0x114c5e['limit'];var _0x2f001c;if(_0x48255a>=_0x149cd8){_0x48255a=_0x149cd8;_0x2f001c=0xc8;}else{_0x2f001c=0xce;}_0x2a252b['status'](_0x2f001c);return _0x2a252b[_0xb79c('0x1e')](_0xb79c('0x1f'),_0x42831f+'-'+_0x48255a+'/'+_0x149cd8)['json'](_0x3ed0ca);}return null;};}function patchUpdates(_0x2012cb){return function(_0x4f57e1){try{jsonpatch['apply'](_0x4f57e1,_0x2012cb,!![]);}catch(_0x32ce38){return BPromise[_0xb79c('0x20')](_0x32ce38);}return _0x4f57e1[_0xb79c('0x21')]();};}function saveUpdates(_0x1b0c21,_0x19b62e){return function(_0x2a5095){if(_0x2a5095){return _0x2a5095[_0xb79c('0x22')](_0x1b0c21)[_0xb79c('0x23')](function(_0x4b3332){return _0x4b3332;});}return null;};}function removeEntity(_0x510c12,_0xc308bb){return function(_0x3cceb1){if(_0x3cceb1){return _0x3cceb1[_0xb79c('0x24')]()[_0xb79c('0x23')](function(){_0x510c12[_0xb79c('0x18')](0xcc)[_0xb79c('0x25')]();});}};}function handleEntityNotFound(_0x1c4f5d,_0x452533){return function(_0x2b1f26){if(!_0x2b1f26){_0x1c4f5d[_0xb79c('0x17')](0x194);}return _0x2b1f26;};}function handleError(_0x2953c1,_0x58a30a){_0x58a30a=_0x58a30a||0x1f4;return function(_0x4c522f){logger['error'](_0x4c522f[_0xb79c('0x26')]);if(_0x4c522f[_0xb79c('0x27')]){delete _0x4c522f[_0xb79c('0x27')];}_0x2953c1[_0xb79c('0x18')](_0x58a30a)['send'](_0x4c522f);};}exports[_0xb79c('0x28')]=function(_0x28576d,_0x9f515e){var _0x41f20c={},_0x4bcbff={},_0x47ea7e={'count':0x0,'rows':[]};var _0x23590f=_['map'](db[_0xb79c('0x29')][_0xb79c('0x2a')],function(_0x33d8ba){return{'name':_0x33d8ba[_0xb79c('0x2b')],'type':_0x33d8ba[_0xb79c('0x2c')][_0xb79c('0x2d')]};});_0x4bcbff[_0xb79c('0x2e')]=_['map'](_0x23590f,_0xb79c('0x27'));_0x4bcbff['query']=_[_0xb79c('0x2f')](_0x28576d['query']);_0x4bcbff[_0xb79c('0x30')]=_[_0xb79c('0x31')](_0x4bcbff[_0xb79c('0x2e')],_0x4bcbff[_0xb79c('0x32')]);_0x41f20c[_0xb79c('0x33')]=_[_0xb79c('0x31')](_0x4bcbff[_0xb79c('0x2e')],qs['fields'](_0x28576d[_0xb79c('0x32')][_0xb79c('0x34')]));_0x41f20c[_0xb79c('0x33')]=_0x41f20c['attributes'][_0xb79c('0x35')]?_0x41f20c[_0xb79c('0x33')]:_0x4bcbff['model'];if(!_0x28576d[_0xb79c('0x32')][_0xb79c('0x36')]('nolimit')){_0x41f20c[_0xb79c('0x1c')]=qs[_0xb79c('0x1c')](_0x28576d[_0xb79c('0x32')][_0xb79c('0x1c')]);_0x41f20c['offset']=qs[_0xb79c('0x1a')](_0x28576d[_0xb79c('0x32')]['offset']);}_0x41f20c[_0xb79c('0x37')]=qs['sort'](_0x28576d[_0xb79c('0x32')][_0xb79c('0x38')]);_0x41f20c[_0xb79c('0x39')]=qs[_0xb79c('0x30')](_[_0xb79c('0x3a')](_0x28576d['query'],_0x4bcbff[_0xb79c('0x30')]),_0x23590f);if(_0x28576d[_0xb79c('0x32')]['filter']){_0x41f20c[_0xb79c('0x39')]=_['merge'](_0x41f20c['where'],{'$or':_[_0xb79c('0x3b')](_0x23590f,function(_0x50d173){if(_0x50d173[_0xb79c('0x2c')]!==_0xb79c('0x3c')){var _0x294a3b={};_0x294a3b[_0x50d173['name']]={'$like':'%'+_0x28576d[_0xb79c('0x32')][_0xb79c('0x3d')]+'%'};return _0x294a3b;}})});}_0x41f20c=_[_0xb79c('0x3e')]({},_0x41f20c,_0x28576d[_0xb79c('0x3f')]);var _0x53587c={'where':_0x41f20c[_0xb79c('0x39')]};return db[_0xb79c('0x29')][_0xb79c('0x1d')](_0x53587c)[_0xb79c('0x23')](function(_0xee6b63){_0x47ea7e['count']=_0xee6b63;if(_0x28576d['query'][_0xb79c('0x40')]){_0x41f20c[_0xb79c('0x41')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x41f20c);})[_0xb79c('0x23')](function(_0x5080c7){_0x47ea7e['rows']=_0x5080c7;return _0x47ea7e;})[_0xb79c('0x23')](respondWithFilteredResult(_0x9f515e,_0x41f20c))[_0xb79c('0x42')](handleError(_0x9f515e,null));};exports[_0xb79c('0x43')]=function(_0x10c424,_0xfe2ddd){var _0x41f8fd={'raw':![],'where':{'id':_0x10c424[_0xb79c('0x44')]['id']}},_0x249914={};_0x249914[_0xb79c('0x2e')]=_['keys'](db[_0xb79c('0x29')][_0xb79c('0x2a')]);_0x249914[_0xb79c('0x32')]=_['keys'](_0x10c424[_0xb79c('0x32')]);_0x249914[_0xb79c('0x30')]=_['intersection'](_0x249914['model'],_0x249914[_0xb79c('0x32')]);_0x41f8fd[_0xb79c('0x33')]=_['intersection'](_0x249914[_0xb79c('0x2e')],qs['fields'](_0x10c424['query']['fields']));_0x41f8fd[_0xb79c('0x33')]=_0x41f8fd[_0xb79c('0x33')][_0xb79c('0x35')]?_0x41f8fd['attributes']:_0x249914[_0xb79c('0x2e')];if(_0x10c424[_0xb79c('0x32')][_0xb79c('0x40')]){_0x41f8fd['include']=[{'all':!![]}];}_0x41f8fd=_['merge']({},_0x41f8fd,_0x10c424['options']);return db[_0xb79c('0x29')][_0xb79c('0x45')](_0x41f8fd)[_0xb79c('0x23')](handleEntityNotFound(_0xfe2ddd,null))[_0xb79c('0x23')](respondWithResult(_0xfe2ddd,null))[_0xb79c('0x42')](handleError(_0xfe2ddd,null));};exports[_0xb79c('0x46')]=function(_0x290f98,_0x3a1d6a){return db[_0xb79c('0x29')][_0xb79c('0x46')](_0x290f98[_0xb79c('0x47')],{})[_0xb79c('0x23')](respondWithResult(_0x3a1d6a,0xc9))['catch'](handleError(_0x3a1d6a,null));};exports[_0xb79c('0x22')]=function(_0x3bf1d7,_0x9226cc){if(_0x3bf1d7[_0xb79c('0x47')]['id']){delete _0x3bf1d7[_0xb79c('0x47')]['id'];}return db[_0xb79c('0x29')][_0xb79c('0x45')]({'where':{'id':_0x3bf1d7['params']['id']}})[_0xb79c('0x23')](handleEntityNotFound(_0x9226cc,null))[_0xb79c('0x23')](saveUpdates(_0x3bf1d7[_0xb79c('0x47')],null))[_0xb79c('0x23')](respondWithResult(_0x9226cc,null))[_0xb79c('0x42')](handleError(_0x9226cc,null));};exports[_0xb79c('0x24')]=function(_0xe17d74,_0xd864fd){return db[_0xb79c('0x29')][_0xb79c('0x45')]({'where':{'id':_0xe17d74[_0xb79c('0x44')]['id']}})['then'](handleEntityNotFound(_0xd864fd,null))[_0xb79c('0x23')](removeEntity(_0xd864fd,null))[_0xb79c('0x42')](handleError(_0xd864fd,null));};exports[_0xb79c('0x48')]=function(_0x2762fd,_0x5ce53f,_0x58edac){var _0x146511={};var _0x17f4cd={};var _0x5399e0;var _0x5341fb;return db[_0xb79c('0x29')][_0xb79c('0x49')]({'where':{'id':_0x2762fd[_0xb79c('0x44')]['id']}})[_0xb79c('0x23')](handleEntityNotFound(_0x5ce53f,null))['then'](function(_0x9c3973){if(_0x9c3973){_0x5399e0=_0x9c3973;_0x17f4cd[_0xb79c('0x2e')]=_[_0xb79c('0x2f')](db[_0xb79c('0x4a')][_0xb79c('0x2a')]);_0x17f4cd[_0xb79c('0x32')]=_[_0xb79c('0x2f')](_0x2762fd['query']);_0x17f4cd[_0xb79c('0x30')]=_['intersection'](_0x17f4cd[_0xb79c('0x2e')],_0x17f4cd[_0xb79c('0x32')]);_0x146511['attributes']=_[_0xb79c('0x31')](_0x17f4cd['model'],qs[_0xb79c('0x34')](_0x2762fd[_0xb79c('0x32')][_0xb79c('0x34')]));_0x146511['attributes']=_0x146511[_0xb79c('0x33')][_0xb79c('0x35')]?_0x146511[_0xb79c('0x33')]:_0x17f4cd[_0xb79c('0x2e')];_0x146511[_0xb79c('0x37')]=qs['sort'](_0x2762fd[_0xb79c('0x32')][_0xb79c('0x38')]);_0x146511['where']=qs['filters'](_[_0xb79c('0x3a')](_0x2762fd[_0xb79c('0x32')],_0x17f4cd[_0xb79c('0x30')]));if(_0x2762fd['query'][_0xb79c('0x3d')]){_0x146511[_0xb79c('0x39')]=_[_0xb79c('0x3e')](_0x146511[_0xb79c('0x39')],{'$or':_['map'](_0x146511[_0xb79c('0x33')],function(_0x2fbb86){var _0x8927e3={};_0x8927e3[_0x2fbb86]={'$like':'%'+_0x2762fd[_0xb79c('0x32')]['filter']+'%'};return _0x8927e3;})});}_0x146511=_[_0xb79c('0x3e')]({},_0x146511,_0x2762fd[_0xb79c('0x3f')]);return _0x5399e0[_0xb79c('0x48')](_0x146511);}})[_0xb79c('0x23')](function(_0x334f90){if(_0x334f90){_0x5341fb=_0x334f90[_0xb79c('0x35')];if(!_0x2762fd[_0xb79c('0x32')][_0xb79c('0x36')](_0xb79c('0x4b'))){_0x146511['limit']=qs[_0xb79c('0x1c')](_0x2762fd[_0xb79c('0x32')][_0xb79c('0x1c')]);_0x146511[_0xb79c('0x1a')]=qs[_0xb79c('0x1a')](_0x2762fd[_0xb79c('0x32')][_0xb79c('0x1a')]);}return _0x5399e0['getFields'](_0x146511);}})[_0xb79c('0x23')](function(_0x18d69c){if(_0x18d69c){return _0x18d69c?{'count':_0x5341fb,'rows':_0x18d69c}:null;}})['then'](respondWithResult(_0x5ce53f,null))['catch'](handleError(_0x5ce53f,null));};exports['getSubjects']=function(_0x582f0d,_0x6765e9,_0x39c85b){var _0x11ba34={};var _0x368e70={};var _0x441b42;var _0x1bb0eb;return db[_0xb79c('0x29')][_0xb79c('0x49')]({'where':{'id':_0x582f0d[_0xb79c('0x44')]['id']}})['then'](handleEntityNotFound(_0x6765e9,null))[_0xb79c('0x23')](function(_0x2d5a00){if(_0x2d5a00){_0x441b42=_0x2d5a00;_0x368e70[_0xb79c('0x2e')]=_[_0xb79c('0x2f')](db[_0xb79c('0x4a')][_0xb79c('0x2a')]);_0x368e70['query']=_[_0xb79c('0x2f')](_0x582f0d[_0xb79c('0x32')]);_0x368e70['filters']=_[_0xb79c('0x31')](_0x368e70[_0xb79c('0x2e')],_0x368e70[_0xb79c('0x32')]);_0x11ba34[_0xb79c('0x33')]=_[_0xb79c('0x31')](_0x368e70[_0xb79c('0x2e')],qs[_0xb79c('0x34')](_0x582f0d[_0xb79c('0x32')][_0xb79c('0x34')]));_0x11ba34[_0xb79c('0x33')]=_0x11ba34[_0xb79c('0x33')][_0xb79c('0x35')]?_0x11ba34[_0xb79c('0x33')]:_0x368e70['model'];_0x11ba34[_0xb79c('0x37')]=qs[_0xb79c('0x38')](_0x582f0d['query'][_0xb79c('0x38')]);_0x11ba34[_0xb79c('0x39')]=qs[_0xb79c('0x30')](_[_0xb79c('0x3a')](_0x582f0d['query'],_0x368e70[_0xb79c('0x30')]));if(_0x582f0d[_0xb79c('0x32')][_0xb79c('0x3d')]){_0x11ba34[_0xb79c('0x39')]=_[_0xb79c('0x3e')](_0x11ba34[_0xb79c('0x39')],{'$or':_[_0xb79c('0x3b')](_0x11ba34[_0xb79c('0x33')],function(_0x23122b){var _0x486c18={};_0x486c18[_0x23122b]={'$like':'%'+_0x582f0d['query'][_0xb79c('0x3d')]+'%'};return _0x486c18;})});}_0x11ba34=_[_0xb79c('0x3e')]({},_0x11ba34,_0x582f0d[_0xb79c('0x3f')]);return _0x441b42['getSubjects'](_0x11ba34);}})[_0xb79c('0x23')](function(_0x4310dc){if(_0x4310dc){_0x1bb0eb=_0x4310dc['length'];if(!_0x582f0d[_0xb79c('0x32')][_0xb79c('0x36')]('nolimit')){_0x11ba34[_0xb79c('0x1c')]=qs[_0xb79c('0x1c')](_0x582f0d[_0xb79c('0x32')][_0xb79c('0x1c')]);_0x11ba34[_0xb79c('0x1a')]=qs[_0xb79c('0x1a')](_0x582f0d[_0xb79c('0x32')]['offset']);}return _0x441b42[_0xb79c('0x4c')](_0x11ba34);}})[_0xb79c('0x23')](function(_0x52aadd){if(_0x52aadd){return _0x52aadd?{'count':_0x1bb0eb,'rows':_0x52aadd}:null;}})[_0xb79c('0x23')](respondWithResult(_0x6765e9,null))[_0xb79c('0x42')](handleError(_0x6765e9,null));};exports['getDescriptions']=function(_0x3efd2d,_0x554ebc,_0x326b86){var _0x369331={};var _0x2ed61d={};var _0x3ae2d3;var _0x31c109;return db[_0xb79c('0x29')][_0xb79c('0x49')]({'where':{'id':_0x3efd2d[_0xb79c('0x44')]['id']}})[_0xb79c('0x23')](handleEntityNotFound(_0x554ebc,null))[_0xb79c('0x23')](function(_0x267bb3){if(_0x267bb3){_0x3ae2d3=_0x267bb3;_0x2ed61d['model']=_[_0xb79c('0x2f')](db['ZendeskField']['rawAttributes']);_0x2ed61d[_0xb79c('0x32')]=_[_0xb79c('0x2f')](_0x3efd2d[_0xb79c('0x32')]);_0x2ed61d['filters']=_[_0xb79c('0x31')](_0x2ed61d[_0xb79c('0x2e')],_0x2ed61d[_0xb79c('0x32')]);_0x369331[_0xb79c('0x33')]=_[_0xb79c('0x31')](_0x2ed61d[_0xb79c('0x2e')],qs[_0xb79c('0x34')](_0x3efd2d[_0xb79c('0x32')][_0xb79c('0x34')]));_0x369331['attributes']=_0x369331[_0xb79c('0x33')][_0xb79c('0x35')]?_0x369331[_0xb79c('0x33')]:_0x2ed61d[_0xb79c('0x2e')];_0x369331['order']=qs[_0xb79c('0x38')](_0x3efd2d['query'][_0xb79c('0x38')]);_0x369331[_0xb79c('0x39')]=qs[_0xb79c('0x30')](_[_0xb79c('0x3a')](_0x3efd2d[_0xb79c('0x32')],_0x2ed61d[_0xb79c('0x30')]));if(_0x3efd2d['query'][_0xb79c('0x3d')]){_0x369331['where']=_[_0xb79c('0x3e')](_0x369331[_0xb79c('0x39')],{'$or':_['map'](_0x369331['attributes'],function(_0x4b7524){var _0x15ee2c={};_0x15ee2c[_0x4b7524]={'$like':'%'+_0x3efd2d['query'][_0xb79c('0x3d')]+'%'};return _0x15ee2c;})});}_0x369331=_['merge']({},_0x369331,_0x3efd2d[_0xb79c('0x3f')]);return _0x3ae2d3[_0xb79c('0x4d')](_0x369331);}})[_0xb79c('0x23')](function(_0x25c6cf){if(_0x25c6cf){_0x31c109=_0x25c6cf['length'];if(!_0x3efd2d[_0xb79c('0x32')][_0xb79c('0x36')](_0xb79c('0x4b'))){_0x369331[_0xb79c('0x1c')]=qs[_0xb79c('0x1c')](_0x3efd2d[_0xb79c('0x32')]['limit']);_0x369331[_0xb79c('0x1a')]=qs[_0xb79c('0x1a')](_0x3efd2d[_0xb79c('0x32')][_0xb79c('0x1a')]);}return _0x3ae2d3[_0xb79c('0x4d')](_0x369331);}})['then'](function(_0x152f1f){if(_0x152f1f){return _0x152f1f?{'count':_0x31c109,'rows':_0x152f1f}:null;}})[_0xb79c('0x23')](respondWithResult(_0x554ebc,null))[_0xb79c('0x42')](handleError(_0x554ebc,null));};exports[_0xb79c('0x4e')]=function(_0x169b6c,_0x434bc6,_0x355111){var _0x2b8a9a={};var _0x4f1524={};var _0x49fa49;var _0x4d075e;return db['ZendeskConfiguration'][_0xb79c('0x49')]({'where':{'id':_0x169b6c[_0xb79c('0x44')]['id']}})[_0xb79c('0x23')](handleEntityNotFound(_0x434bc6,null))[_0xb79c('0x23')](function(_0x15f5c2){if(_0x15f5c2){_0x49fa49=_0x15f5c2;_0x4f1524[_0xb79c('0x2e')]=_[_0xb79c('0x2f')](db[_0xb79c('0x4f')]['rawAttributes']);_0x4f1524[_0xb79c('0x32')]=_[_0xb79c('0x2f')](_0x169b6c[_0xb79c('0x32')]);_0x4f1524[_0xb79c('0x30')]=_[_0xb79c('0x31')](_0x4f1524[_0xb79c('0x2e')],_0x4f1524['query']);_0x2b8a9a['attributes']=_[_0xb79c('0x31')](_0x4f1524[_0xb79c('0x2e')],qs[_0xb79c('0x34')](_0x169b6c['query']['fields']));_0x2b8a9a[_0xb79c('0x33')]=_0x2b8a9a[_0xb79c('0x33')][_0xb79c('0x35')]?_0x2b8a9a[_0xb79c('0x33')]:_0x4f1524[_0xb79c('0x2e')];_0x2b8a9a[_0xb79c('0x37')]=qs[_0xb79c('0x38')](_0x169b6c[_0xb79c('0x32')][_0xb79c('0x38')]);_0x2b8a9a[_0xb79c('0x39')]=qs['filters'](_[_0xb79c('0x3a')](_0x169b6c[_0xb79c('0x32')],_0x4f1524[_0xb79c('0x30')]));if(_0x169b6c['query'][_0xb79c('0x3d')]){_0x2b8a9a[_0xb79c('0x39')]=_['merge'](_0x2b8a9a[_0xb79c('0x39')],{'$or':_[_0xb79c('0x3b')](_0x2b8a9a[_0xb79c('0x33')],function(_0x51fb04){var _0x179b75={};_0x179b75[_0x51fb04]={'$like':'%'+_0x169b6c[_0xb79c('0x32')][_0xb79c('0x3d')]+'%'};return _0x179b75;})});}_0x2b8a9a=_['merge']({},_0x2b8a9a,_0x169b6c['options']);return _0x49fa49[_0xb79c('0x4e')](_0x2b8a9a);}})[_0xb79c('0x23')](function(_0xe4e057){if(_0xe4e057){_0x4d075e=_0xe4e057[_0xb79c('0x35')];if(!_0x169b6c[_0xb79c('0x32')]['hasOwnProperty'](_0xb79c('0x4b'))){_0x2b8a9a[_0xb79c('0x1c')]=qs['limit'](_0x169b6c['query'][_0xb79c('0x1c')]);_0x2b8a9a['offset']=qs[_0xb79c('0x1a')](_0x169b6c['query'][_0xb79c('0x1a')]);}return _0x49fa49[_0xb79c('0x4e')](_0x2b8a9a);}})['then'](function(_0x80db9b){if(_0x80db9b){return _0x80db9b?{'count':_0x4d075e,'rows':_0x80db9b}:null;}})[_0xb79c('0x23')](respondWithResult(_0x434bc6,null))[_0xb79c('0x42')](handleError(_0x434bc6,null));};exports['setTags']=function(_0x5796b0,_0x52986b,_0x2109b6){if(_0x5796b0[_0xb79c('0x47')]['id']){delete _0x5796b0[_0xb79c('0x47')]['id'];}return db[_0xb79c('0x29')][_0xb79c('0x49')]({'where':{'id':_0x5796b0[_0xb79c('0x44')]['id']}})[_0xb79c('0x23')](handleEntityNotFound(_0x52986b,null))[_0xb79c('0x23')](function(_0x577f78){if(_0x577f78){return _0x577f78[_0xb79c('0x50')](_0x5796b0[_0xb79c('0x47')][_0xb79c('0x51')]||[]);}return null;})[_0xb79c('0x23')](respondWithResult(_0x52986b,null))[_0xb79c('0x42')](handleError(_0x52986b,null));};
\ No newline at end of file