Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index b58126e..ea643b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0932=['find','create','body','params','getFields','order','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','index','map','ZendeskConfiguration','fieldName','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','keys','rawAttributes'];(function(_0x517ad3,_0x3015d5){var _0x3c69d6=function(_0xef0f04){while(--_0xef0f04){_0x517ad3['push'](_0x517ad3['shift']());}};_0x3c69d6(++_0x3015d5);}(_0x0932,0xd8));var _0x2093=function(_0x366efe,_0x3da6b7){_0x366efe=_0x366efe-0x0;var _0x34ef8f=_0x0932[_0x366efe];return _0x34ef8f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2093('0x0'));var rimraf=require(_0x2093('0x1'));var zipdir=require(_0x2093('0x2'));var jsonpatch=require(_0x2093('0x3'));var rp=require('request-promise');var moment=require(_0x2093('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2093('0x5'));var util=require(_0x2093('0x6'));var path=require(_0x2093('0x7'));var sox=require(_0x2093('0x8'));var csv=require('to-csv');var ejs=require(_0x2093('0x9'));var fs=require('fs');var _=require(_0x2093('0xa'));var squel=require(_0x2093('0xb'));var crypto=require(_0x2093('0xc'));var jsforce=require(_0x2093('0xd'));var deskjs=require(_0x2093('0xe'));var toCsv=require(_0x2093('0xf'));var querystring=require(_0x2093('0x10'));var Papa=require(_0x2093('0x11'));var Redis=require(_0x2093('0x12'));var authService=require(_0x2093('0x13'));var qs=require(_0x2093('0x14'));var as=require(_0x2093('0x15'));var hardwareService=require(_0x2093('0x16'));var logger=require(_0x2093('0x17'))(_0x2093('0x18'));var utils=require('../../config/utils');var config=require(_0x2093('0x19'));var db=require(_0x2093('0x1a'))['db'];var jayson=require(_0x2093('0x1b'));var client=jayson[_0x2093('0x1c')][_0x2093('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x573dff,_0x2bf8ed,_0x46c551){if(_0x46c551){var _0x551650=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x551650[_0x2093('0x1e')](_0x2bf8ed)){return _0x573dff;}else{throw new db[(_0x2093('0x1f'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x573dff;}}function respondWithRpcPromise(_0x280dc1,_0x4b1060,_0x3f180c,_0x46d551){return new BPromise(function(_0x4e2428,_0x5df1a1){var _0xc128c6=_0x46d551||client;return _0xc128c6[_0x2093('0x20')](_0x280dc1,_0x3f180c)['then'](function(_0x22c290){logger[_0x2093('0x21')](_0x2093('0x22'),_0x4b1060,'request\x20sent');logger[_0x2093('0x23')](_0x2093('0x24'),_0x4b1060,_0x2093('0x25'),JSON[_0x2093('0x26')](_0x22c290));if(_0x22c290['error']){if(_0x22c290['error'][_0x2093('0x27')]===0x1f4){logger['error'](_0x2093('0x22'),_0x4b1060,_0x22c290['error'][_0x2093('0x28')]);return _0x5df1a1(_0x22c290[_0x2093('0x29')][_0x2093('0x28')]);}logger[_0x2093('0x29')](_0x2093('0x22'),_0x4b1060,_0x22c290[_0x2093('0x29')][_0x2093('0x28')]);return _0x4e2428(_0x22c290[_0x2093('0x29')][_0x2093('0x28')]);}else{logger[_0x2093('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4b1060,_0x2093('0x25'));_0x4e2428(_0x22c290[_0x2093('0x2a')][_0x2093('0x28')]);}})[_0x2093('0x2b')](function(_0x26c5e2){logger[_0x2093('0x29')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4b1060,_0x26c5e2);_0x5df1a1(_0x26c5e2);});});}function respondWithStatusCode(_0x1c08a1,_0x2a76ce){_0x2a76ce=_0x2a76ce||0xcc;return function(_0x20383d){if(_0x20383d){return _0x1c08a1['sendStatus'](_0x2a76ce);}return _0x1c08a1[_0x2093('0x2c')](_0x2a76ce)[_0x2093('0x2d')]();};}function respondWithResult(_0x3c6bb1,_0x507fec){_0x507fec=_0x507fec||0xc8;return function(_0x14bba3){if(_0x14bba3){return _0x3c6bb1['status'](_0x507fec)[_0x2093('0x2e')](_0x14bba3);}};}function respondWithFilteredResult(_0x3dd0b3,_0x5e7a16){return function(_0x1ce05){if(_0x1ce05){var _0x18ad84=_0x1ce05[_0x2093('0x2f')],_0xe2a8ae=_0x5e7a16[_0x2093('0x30')],_0x339b09=_0x5e7a16[_0x2093('0x30')]+_0x5e7a16[_0x2093('0x31')],_0x2e02e7;if(_0x339b09>=_0x18ad84){_0x339b09=_0x18ad84;_0x2e02e7=0xc8;}else{_0x2e02e7=0xce;}_0x3dd0b3[_0x2093('0x2c')](_0x2e02e7);return _0x3dd0b3[_0x2093('0x32')](_0x2093('0x33'),_0xe2a8ae+'-'+_0x339b09+'/'+_0x18ad84)['json'](_0x1ce05);}return null;};}function patchUpdates(_0x482c30){return function(_0x2dccaa){try{jsonpatch[_0x2093('0x34')](_0x2dccaa,_0x482c30,!![]);}catch(_0x298539){return BPromise['reject'](_0x298539);}return _0x2dccaa[_0x2093('0x35')]();};}function saveUpdates(_0x11dc8a,_0x1bd2a6){return function(_0x282eea){if(_0x282eea){return _0x282eea[_0x2093('0x36')](_0x11dc8a)[_0x2093('0x37')](function(_0x2ad8cc){return _0x2ad8cc;});}return null;};}function removeEntity(_0x4f2fa9,_0x9cb089){return function(_0x5d0eb3){if(_0x5d0eb3){return _0x5d0eb3[_0x2093('0x38')]()[_0x2093('0x37')](function(){_0x4f2fa9[_0x2093('0x2c')](0xcc)[_0x2093('0x2d')]();});}};}function handleEntityNotFound(_0x42b35b,_0x5944b0){return function(_0x31431a){if(!_0x31431a){_0x42b35b[_0x2093('0x39')](0x194);}return _0x31431a;};}function handleError(_0x455f02,_0x526214){_0x526214=_0x526214||0x1f4;return function(_0x43d061){logger[_0x2093('0x29')](_0x43d061[_0x2093('0x3a')]);if(_0x43d061[_0x2093('0x3b')]){delete _0x43d061['name'];}_0x455f02[_0x2093('0x2c')](_0x526214)['send'](_0x43d061);};}exports[_0x2093('0x3c')]=function(_0x3dfedf,_0x121fa6){var _0x20fd60={},_0x1133fc={},_0x457bad={'count':0x0,'rows':[]};var _0x667bc7=_[_0x2093('0x3d')](db[_0x2093('0x3e')]['rawAttributes'],function(_0x42bd70){return{'name':_0x42bd70[_0x2093('0x3f')],'type':_0x42bd70['type'][_0x2093('0x40')]};});_0x1133fc['model']=_['map'](_0x667bc7,_0x2093('0x3b'));_0x1133fc['query']=_['keys'](_0x3dfedf[_0x2093('0x41')]);_0x1133fc['filters']=_['intersection'](_0x1133fc[_0x2093('0x42')],_0x1133fc[_0x2093('0x41')]);_0x20fd60[_0x2093('0x43')]=_[_0x2093('0x44')](_0x1133fc[_0x2093('0x42')],qs[_0x2093('0x45')](_0x3dfedf[_0x2093('0x41')][_0x2093('0x45')]));_0x20fd60['attributes']=_0x20fd60['attributes'][_0x2093('0x46')]?_0x20fd60['attributes']:_0x1133fc[_0x2093('0x42')];if(!_0x3dfedf[_0x2093('0x41')][_0x2093('0x47')](_0x2093('0x48'))){_0x20fd60[_0x2093('0x31')]=qs[_0x2093('0x31')](_0x3dfedf['query']['limit']);_0x20fd60['offset']=qs[_0x2093('0x30')](_0x3dfedf['query']['offset']);}_0x20fd60['order']=qs['sort'](_0x3dfedf[_0x2093('0x41')][_0x2093('0x49')]);_0x20fd60['where']=qs[_0x2093('0x4a')](_[_0x2093('0x4b')](_0x3dfedf[_0x2093('0x41')],_0x1133fc[_0x2093('0x4a')]),_0x667bc7);if(_0x3dfedf['query'][_0x2093('0x4c')]){_0x20fd60['where']=_[_0x2093('0x4d')](_0x20fd60[_0x2093('0x4e')],{'$or':_[_0x2093('0x3d')](_0x667bc7,function(_0x19a856){if(_0x19a856['type']!=='VIRTUAL'){var _0x2679f2={};_0x2679f2[_0x19a856['name']]={'$like':'%'+_0x3dfedf['query'][_0x2093('0x4c')]+'%'};return _0x2679f2;}})});}_0x20fd60=_['merge']({},_0x20fd60,_0x3dfedf[_0x2093('0x4f')]);var _0x20cc42={'where':_0x20fd60[_0x2093('0x4e')]};return db[_0x2093('0x3e')][_0x2093('0x2f')](_0x20cc42)[_0x2093('0x37')](function(_0x4960b8){_0x457bad[_0x2093('0x2f')]=_0x4960b8;if(_0x3dfedf[_0x2093('0x41')][_0x2093('0x50')]){_0x20fd60[_0x2093('0x51')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x2093('0x52')](_0x20fd60);})[_0x2093('0x37')](function(_0x2437eb){_0x457bad[_0x2093('0x53')]=_0x2437eb;return _0x457bad;})[_0x2093('0x37')](respondWithFilteredResult(_0x121fa6,_0x20fd60))[_0x2093('0x2b')](handleError(_0x121fa6,null));};exports[_0x2093('0x54')]=function(_0x40a33c,_0xc35337){var _0x483a47={'raw':![],'where':{'id':_0x40a33c['params']['id']}},_0x31b706={};_0x31b706[_0x2093('0x42')]=_[_0x2093('0x55')](db[_0x2093('0x3e')][_0x2093('0x56')]);_0x31b706[_0x2093('0x41')]=_['keys'](_0x40a33c[_0x2093('0x41')]);_0x31b706[_0x2093('0x4a')]=_['intersection'](_0x31b706['model'],_0x31b706[_0x2093('0x41')]);_0x483a47[_0x2093('0x43')]=_[_0x2093('0x44')](_0x31b706[_0x2093('0x42')],qs[_0x2093('0x45')](_0x40a33c[_0x2093('0x41')][_0x2093('0x45')]));_0x483a47[_0x2093('0x43')]=_0x483a47['attributes']['length']?_0x483a47[_0x2093('0x43')]:_0x31b706[_0x2093('0x42')];if(_0x40a33c[_0x2093('0x41')]['includeAll']){_0x483a47[_0x2093('0x51')]=[{'all':!![]}];}_0x483a47=_[_0x2093('0x4d')]({},_0x483a47,_0x40a33c[_0x2093('0x4f')]);return db['ZendeskConfiguration'][_0x2093('0x57')](_0x483a47)['then'](handleEntityNotFound(_0xc35337,null))[_0x2093('0x37')](respondWithResult(_0xc35337,null))[_0x2093('0x2b')](handleError(_0xc35337,null));};exports[_0x2093('0x58')]=function(_0x45d9eb,_0x7aa42d){return db['ZendeskConfiguration'][_0x2093('0x58')](_0x45d9eb[_0x2093('0x59')],{})['then'](respondWithResult(_0x7aa42d,0xc9))[_0x2093('0x2b')](handleError(_0x7aa42d,null));};exports['update']=function(_0x57993d,_0x2cfd9d){if(_0x57993d['body']['id']){delete _0x57993d['body']['id'];}return db[_0x2093('0x3e')]['find']({'where':{'id':_0x57993d[_0x2093('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2cfd9d,null))[_0x2093('0x37')](saveUpdates(_0x57993d['body'],null))[_0x2093('0x37')](respondWithResult(_0x2cfd9d,null))[_0x2093('0x2b')](handleError(_0x2cfd9d,null));};exports[_0x2093('0x38')]=function(_0x556658,_0x4e03aa){return db['ZendeskConfiguration']['find']({'where':{'id':_0x556658['params']['id']}})['then'](handleEntityNotFound(_0x4e03aa,null))[_0x2093('0x37')](removeEntity(_0x4e03aa,null))[_0x2093('0x2b')](handleError(_0x4e03aa,null));};exports[_0x2093('0x5b')]=function(_0x701292,_0xe9b5f5,_0x1c045c){var _0x4397c2={};var _0x42e04e={};var _0x252334;var _0x3fa94d;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x701292[_0x2093('0x5a')]['id']}})[_0x2093('0x37')](handleEntityNotFound(_0xe9b5f5,null))[_0x2093('0x37')](function(_0x6d719a){if(_0x6d719a){_0x252334=_0x6d719a;_0x42e04e[_0x2093('0x42')]=_['keys'](db['ZendeskField'][_0x2093('0x56')]);_0x42e04e[_0x2093('0x41')]=_['keys'](_0x701292[_0x2093('0x41')]);_0x42e04e[_0x2093('0x4a')]=_[_0x2093('0x44')](_0x42e04e[_0x2093('0x42')],_0x42e04e['query']);_0x4397c2[_0x2093('0x43')]=_['intersection'](_0x42e04e[_0x2093('0x42')],qs[_0x2093('0x45')](_0x701292[_0x2093('0x41')]['fields']));_0x4397c2[_0x2093('0x43')]=_0x4397c2[_0x2093('0x43')][_0x2093('0x46')]?_0x4397c2['attributes']:_0x42e04e[_0x2093('0x42')];_0x4397c2[_0x2093('0x5c')]=qs['sort'](_0x701292['query'][_0x2093('0x49')]);_0x4397c2['where']=qs[_0x2093('0x4a')](_['pick'](_0x701292[_0x2093('0x41')],_0x42e04e['filters']));if(_0x701292['query'][_0x2093('0x4c')]){_0x4397c2[_0x2093('0x4e')]=_[_0x2093('0x4d')](_0x4397c2[_0x2093('0x4e')],{'$or':_[_0x2093('0x3d')](_0x4397c2['attributes'],function(_0x54bdd4){var _0x13e761={};_0x13e761[_0x54bdd4]={'$like':'%'+_0x701292[_0x2093('0x41')][_0x2093('0x4c')]+'%'};return _0x13e761;})});}_0x4397c2=_[_0x2093('0x4d')]({},_0x4397c2,_0x701292[_0x2093('0x4f')]);return _0x252334[_0x2093('0x5b')](_0x4397c2);}})['then'](function(_0x19e713){if(_0x19e713){_0x3fa94d=_0x19e713[_0x2093('0x46')];if(!_0x701292[_0x2093('0x41')][_0x2093('0x47')](_0x2093('0x48'))){_0x4397c2[_0x2093('0x31')]=qs['limit'](_0x701292[_0x2093('0x41')]['limit']);_0x4397c2['offset']=qs[_0x2093('0x30')](_0x701292[_0x2093('0x41')][_0x2093('0x30')]);}return _0x252334[_0x2093('0x5b')](_0x4397c2);}})[_0x2093('0x37')](function(_0xb4b4dd){if(_0xb4b4dd){return _0xb4b4dd?{'count':_0x3fa94d,'rows':_0xb4b4dd}:null;}})[_0x2093('0x37')](respondWithResult(_0xe9b5f5,null))[_0x2093('0x2b')](handleError(_0xe9b5f5,null));};exports[_0x2093('0x5d')]=function(_0x292b72,_0x42bce7,_0x5298f3){var _0x135e67={};var _0x44c216={};var _0x425221;var _0x4fb4df;return db[_0x2093('0x3e')][_0x2093('0x5e')]({'where':{'id':_0x292b72[_0x2093('0x5a')]['id']}})[_0x2093('0x37')](handleEntityNotFound(_0x42bce7,null))[_0x2093('0x37')](function(_0x1b5f35){if(_0x1b5f35){_0x425221=_0x1b5f35;_0x44c216[_0x2093('0x42')]=_[_0x2093('0x55')](db[_0x2093('0x5f')][_0x2093('0x56')]);_0x44c216['query']=_[_0x2093('0x55')](_0x292b72[_0x2093('0x41')]);_0x44c216['filters']=_[_0x2093('0x44')](_0x44c216[_0x2093('0x42')],_0x44c216['query']);_0x135e67['attributes']=_[_0x2093('0x44')](_0x44c216['model'],qs[_0x2093('0x45')](_0x292b72[_0x2093('0x41')][_0x2093('0x45')]));_0x135e67[_0x2093('0x43')]=_0x135e67[_0x2093('0x43')][_0x2093('0x46')]?_0x135e67['attributes']:_0x44c216[_0x2093('0x42')];_0x135e67[_0x2093('0x5c')]=qs[_0x2093('0x49')](_0x292b72[_0x2093('0x41')][_0x2093('0x49')]);_0x135e67[_0x2093('0x4e')]=qs[_0x2093('0x4a')](_[_0x2093('0x4b')](_0x292b72[_0x2093('0x41')],_0x44c216[_0x2093('0x4a')]));if(_0x292b72['query'][_0x2093('0x4c')]){_0x135e67[_0x2093('0x4e')]=_[_0x2093('0x4d')](_0x135e67[_0x2093('0x4e')],{'$or':_[_0x2093('0x3d')](_0x135e67[_0x2093('0x43')],function(_0x28afcf){var _0x35ff6f={};_0x35ff6f[_0x28afcf]={'$like':'%'+_0x292b72[_0x2093('0x41')][_0x2093('0x4c')]+'%'};return _0x35ff6f;})});}_0x135e67=_[_0x2093('0x4d')]({},_0x135e67,_0x292b72[_0x2093('0x4f')]);return _0x425221[_0x2093('0x5d')](_0x135e67);}})['then'](function(_0x6fe885){if(_0x6fe885){_0x4fb4df=_0x6fe885[_0x2093('0x46')];if(!_0x292b72[_0x2093('0x41')][_0x2093('0x47')](_0x2093('0x48'))){_0x135e67[_0x2093('0x31')]=qs[_0x2093('0x31')](_0x292b72['query'][_0x2093('0x31')]);_0x135e67[_0x2093('0x30')]=qs[_0x2093('0x30')](_0x292b72[_0x2093('0x41')][_0x2093('0x30')]);}return _0x425221[_0x2093('0x5d')](_0x135e67);}})['then'](function(_0x35d424){if(_0x35d424){return _0x35d424?{'count':_0x4fb4df,'rows':_0x35d424}:null;}})[_0x2093('0x37')](respondWithResult(_0x42bce7,null))[_0x2093('0x2b')](handleError(_0x42bce7,null));};exports[_0x2093('0x60')]=function(_0xf7b13d,_0x36ca67,_0x1d7889){var _0x72eab7={};var _0x47103e={};var _0x16388a;var _0x56d851;return db[_0x2093('0x3e')][_0x2093('0x5e')]({'where':{'id':_0xf7b13d[_0x2093('0x5a')]['id']}})['then'](handleEntityNotFound(_0x36ca67,null))[_0x2093('0x37')](function(_0x4038f7){if(_0x4038f7){_0x16388a=_0x4038f7;_0x47103e[_0x2093('0x42')]=_[_0x2093('0x55')](db[_0x2093('0x5f')][_0x2093('0x56')]);_0x47103e['query']=_[_0x2093('0x55')](_0xf7b13d['query']);_0x47103e[_0x2093('0x4a')]=_['intersection'](_0x47103e[_0x2093('0x42')],_0x47103e[_0x2093('0x41')]);_0x72eab7[_0x2093('0x43')]=_[_0x2093('0x44')](_0x47103e['model'],qs['fields'](_0xf7b13d[_0x2093('0x41')][_0x2093('0x45')]));_0x72eab7[_0x2093('0x43')]=_0x72eab7[_0x2093('0x43')][_0x2093('0x46')]?_0x72eab7[_0x2093('0x43')]:_0x47103e['model'];_0x72eab7[_0x2093('0x5c')]=qs[_0x2093('0x49')](_0xf7b13d[_0x2093('0x41')]['sort']);_0x72eab7[_0x2093('0x4e')]=qs['filters'](_['pick'](_0xf7b13d[_0x2093('0x41')],_0x47103e[_0x2093('0x4a')]));if(_0xf7b13d[_0x2093('0x41')]['filter']){_0x72eab7[_0x2093('0x4e')]=_[_0x2093('0x4d')](_0x72eab7[_0x2093('0x4e')],{'$or':_['map'](_0x72eab7['attributes'],function(_0x6f5fe8){var _0x13441e={};_0x13441e[_0x6f5fe8]={'$like':'%'+_0xf7b13d['query'][_0x2093('0x4c')]+'%'};return _0x13441e;})});}_0x72eab7=_[_0x2093('0x4d')]({},_0x72eab7,_0xf7b13d['options']);return _0x16388a[_0x2093('0x60')](_0x72eab7);}})[_0x2093('0x37')](function(_0x5056b9){if(_0x5056b9){_0x56d851=_0x5056b9[_0x2093('0x46')];if(!_0xf7b13d[_0x2093('0x41')][_0x2093('0x47')](_0x2093('0x48'))){_0x72eab7['limit']=qs[_0x2093('0x31')](_0xf7b13d[_0x2093('0x41')]['limit']);_0x72eab7[_0x2093('0x30')]=qs['offset'](_0xf7b13d['query'][_0x2093('0x30')]);}return _0x16388a[_0x2093('0x60')](_0x72eab7);}})[_0x2093('0x37')](function(_0x405a2f){if(_0x405a2f){return _0x405a2f?{'count':_0x56d851,'rows':_0x405a2f}:null;}})[_0x2093('0x37')](respondWithResult(_0x36ca67,null))[_0x2093('0x2b')](handleError(_0x36ca67,null));};exports[_0x2093('0x61')]=function(_0x2c857a,_0x4f3328,_0x5c8254){var _0x220ad4={};var _0x3fb74c={};var _0x2391c2;var _0xda1d7e;return db['ZendeskConfiguration'][_0x2093('0x5e')]({'where':{'id':_0x2c857a[_0x2093('0x5a')]['id']}})[_0x2093('0x37')](handleEntityNotFound(_0x4f3328,null))[_0x2093('0x37')](function(_0x1ada84){if(_0x1ada84){_0x2391c2=_0x1ada84;_0x3fb74c['model']=_[_0x2093('0x55')](db[_0x2093('0x62')][_0x2093('0x56')]);_0x3fb74c['query']=_['keys'](_0x2c857a[_0x2093('0x41')]);_0x3fb74c[_0x2093('0x4a')]=_['intersection'](_0x3fb74c['model'],_0x3fb74c['query']);_0x220ad4[_0x2093('0x43')]=_[_0x2093('0x44')](_0x3fb74c[_0x2093('0x42')],qs['fields'](_0x2c857a[_0x2093('0x41')][_0x2093('0x45')]));_0x220ad4['attributes']=_0x220ad4[_0x2093('0x43')][_0x2093('0x46')]?_0x220ad4[_0x2093('0x43')]:_0x3fb74c[_0x2093('0x42')];_0x220ad4[_0x2093('0x5c')]=qs[_0x2093('0x49')](_0x2c857a['query'][_0x2093('0x49')]);_0x220ad4['where']=qs[_0x2093('0x4a')](_[_0x2093('0x4b')](_0x2c857a[_0x2093('0x41')],_0x3fb74c['filters']));if(_0x2c857a[_0x2093('0x41')][_0x2093('0x4c')]){_0x220ad4[_0x2093('0x4e')]=_[_0x2093('0x4d')](_0x220ad4[_0x2093('0x4e')],{'$or':_['map'](_0x220ad4['attributes'],function(_0x4407b5){var _0x2a96f0={};_0x2a96f0[_0x4407b5]={'$like':'%'+_0x2c857a[_0x2093('0x41')]['filter']+'%'};return _0x2a96f0;})});}_0x220ad4=_[_0x2093('0x4d')]({},_0x220ad4,_0x2c857a[_0x2093('0x4f')]);return _0x2391c2[_0x2093('0x61')](_0x220ad4);}})[_0x2093('0x37')](function(_0x2a959b){if(_0x2a959b){_0xda1d7e=_0x2a959b[_0x2093('0x46')];if(!_0x2c857a[_0x2093('0x41')][_0x2093('0x47')]('nolimit')){_0x220ad4[_0x2093('0x31')]=qs[_0x2093('0x31')](_0x2c857a[_0x2093('0x41')][_0x2093('0x31')]);_0x220ad4[_0x2093('0x30')]=qs[_0x2093('0x30')](_0x2c857a[_0x2093('0x41')]['offset']);}return _0x2391c2['getTags'](_0x220ad4);}})[_0x2093('0x37')](function(_0x1c9784){if(_0x1c9784){return _0x1c9784?{'count':_0xda1d7e,'rows':_0x1c9784}:null;}})[_0x2093('0x37')](respondWithResult(_0x4f3328,null))['catch'](handleError(_0x4f3328,null));};exports[_0x2093('0x63')]=function(_0x248475,_0x48d6d0,_0x173bef){if(_0x248475[_0x2093('0x59')]['id']){delete _0x248475[_0x2093('0x59')]['id'];}return db[_0x2093('0x3e')][_0x2093('0x5e')]({'where':{'id':_0x248475[_0x2093('0x5a')]['id']}})[_0x2093('0x37')](handleEntityNotFound(_0x48d6d0,null))[_0x2093('0x37')](function(_0x4b4249){if(_0x4b4249){return _0x4b4249['setTags'](_0x248475[_0x2093('0x59')][_0x2093('0x64')]||[]);}return null;})[_0x2093('0x37')](respondWithResult(_0x48d6d0,null))[_0x2093('0x2b')](handleError(_0x48d6d0,null));};
\ No newline at end of file
+var _0xff86=['stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','merge','find','create','body','ZendeskField','order','pick','getFields','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus'];(function(_0x5dff0c,_0x2bdeb4){var _0x15615f=function(_0x22956e){while(--_0x22956e){_0x5dff0c['push'](_0x5dff0c['shift']());}};_0x15615f(++_0x2bdeb4);}(_0xff86,0x129));var _0x6ff8=function(_0x16b606,_0x49f3ab){_0x16b606=_0x16b606-0x0;var _0xbd122c=_0xff86[_0x16b606];return _0xbd122c;};'use strict';var emlformat=require(_0x6ff8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ff8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ff8('0x2'));var Mustache=require(_0x6ff8('0x3'));var util=require(_0x6ff8('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x6ff8('0x5'));var ejs=require(_0x6ff8('0x6'));var fs=require('fs');var fs_extra=require(_0x6ff8('0x7'));var _=require(_0x6ff8('0x8'));var squel=require(_0x6ff8('0x9'));var crypto=require(_0x6ff8('0xa'));var jsforce=require(_0x6ff8('0xb'));var deskjs=require(_0x6ff8('0xc'));var toCsv=require(_0x6ff8('0x5'));var querystring=require(_0x6ff8('0xd'));var Papa=require(_0x6ff8('0xe'));var Redis=require(_0x6ff8('0xf'));var authService=require(_0x6ff8('0x10'));var qs=require(_0x6ff8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ff8('0x12'));var logger=require('../../config/logger')(_0x6ff8('0x13'));var utils=require(_0x6ff8('0x14'));var config=require(_0x6ff8('0x15'));var licenseUtil=require(_0x6ff8('0x16'));var db=require(_0x6ff8('0x17'))['db'];function respondWithStatusCode(_0x303cc8,_0x5191b7){_0x5191b7=_0x5191b7||0xcc;return function(_0x304495){if(_0x304495){return _0x303cc8['sendStatus'](_0x5191b7);}return _0x303cc8[_0x6ff8('0x18')](_0x5191b7)[_0x6ff8('0x19')]();};}function respondWithResult(_0xf4afa3,_0x42da82){_0x42da82=_0x42da82||0xc8;return function(_0x4b2a99){if(_0x4b2a99){return _0xf4afa3[_0x6ff8('0x18')](_0x42da82)[_0x6ff8('0x1a')](_0x4b2a99);}};}function respondWithFilteredResult(_0x4b1c68,_0x13ed0c){return function(_0x331456){if(_0x331456){var _0x3bfc39=typeof _0x13ed0c[_0x6ff8('0x1b')]===_0x6ff8('0x1c')&&typeof _0x13ed0c['limit']===_0x6ff8('0x1c');var _0xb5c285=_0x331456[_0x6ff8('0x1d')];var _0x58b05e=_0x3bfc39?0x0:_0x13ed0c[_0x6ff8('0x1b')];var _0x337333=_0x3bfc39?_0x331456[_0x6ff8('0x1d')]:_0x13ed0c[_0x6ff8('0x1b')]+_0x13ed0c[_0x6ff8('0x1e')];var _0x6cb150;if(_0x337333>=_0xb5c285){_0x337333=_0xb5c285;_0x6cb150=0xc8;}else{_0x6cb150=0xce;}_0x4b1c68[_0x6ff8('0x18')](_0x6cb150);return _0x4b1c68[_0x6ff8('0x1f')](_0x6ff8('0x20'),_0x58b05e+'-'+_0x337333+'/'+_0xb5c285)['json'](_0x331456);}return null;};}function patchUpdates(_0x3ce5ab){return function(_0x38f58c){try{jsonpatch['apply'](_0x38f58c,_0x3ce5ab,!![]);}catch(_0x48323d){return BPromise[_0x6ff8('0x21')](_0x48323d);}return _0x38f58c[_0x6ff8('0x22')]();};}function saveUpdates(_0x53ffe7,_0x10c0a4){return function(_0xbcd13e){if(_0xbcd13e){return _0xbcd13e[_0x6ff8('0x23')](_0x53ffe7)[_0x6ff8('0x24')](function(_0x359b63){return _0x359b63;});}return null;};}function removeEntity(_0x3dd12f,_0x572e4e){return function(_0x5e366a){if(_0x5e366a){return _0x5e366a[_0x6ff8('0x25')]()['then'](function(){_0x3dd12f[_0x6ff8('0x18')](0xcc)[_0x6ff8('0x19')]();});}};}function handleEntityNotFound(_0x20163c,_0x48c336){return function(_0x31dbd0){if(!_0x31dbd0){_0x20163c[_0x6ff8('0x26')](0x194);}return _0x31dbd0;};}function handleError(_0x168279,_0x10a468){_0x10a468=_0x10a468||0x1f4;return function(_0xea1003){logger['error'](_0xea1003[_0x6ff8('0x27')]);if(_0xea1003[_0x6ff8('0x28')]){delete _0xea1003[_0x6ff8('0x28')];}_0x168279['status'](_0x10a468)[_0x6ff8('0x29')](_0xea1003);};}exports[_0x6ff8('0x2a')]=function(_0x84d93,_0x28fb94){var _0xf8f9c5={},_0xe9163={},_0x3057d8={'count':0x0,'rows':[]};var _0x3fdfdc=_[_0x6ff8('0x2b')](db[_0x6ff8('0x2c')][_0x6ff8('0x2d')],function(_0x19315e){return{'name':_0x19315e['fieldName'],'type':_0x19315e[_0x6ff8('0x2e')][_0x6ff8('0x2f')]};});_0xe9163[_0x6ff8('0x30')]=_[_0x6ff8('0x2b')](_0x3fdfdc,_0x6ff8('0x28'));_0xe9163['query']=_[_0x6ff8('0x31')](_0x84d93[_0x6ff8('0x32')]);_0xe9163[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0xe9163['model'],_0xe9163[_0x6ff8('0x32')]);_0xf8f9c5[_0x6ff8('0x35')]=_[_0x6ff8('0x34')](_0xe9163[_0x6ff8('0x30')],qs['fields'](_0x84d93[_0x6ff8('0x32')]['fields']));_0xf8f9c5['attributes']=_0xf8f9c5['attributes'][_0x6ff8('0x36')]?_0xf8f9c5[_0x6ff8('0x35')]:_0xe9163[_0x6ff8('0x30')];if(!_0x84d93[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0xf8f9c5[_0x6ff8('0x1e')]=qs['limit'](_0x84d93[_0x6ff8('0x32')]['limit']);_0xf8f9c5[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x84d93[_0x6ff8('0x32')]['offset']);}_0xf8f9c5['order']=qs[_0x6ff8('0x39')](_0x84d93[_0x6ff8('0x32')]['sort']);_0xf8f9c5[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_['pick'](_0x84d93[_0x6ff8('0x32')],_0xe9163['filters']),_0x3fdfdc);if(_0x84d93[_0x6ff8('0x32')][_0x6ff8('0x3b')]){_0xf8f9c5[_0x6ff8('0x3a')]=_['merge'](_0xf8f9c5['where'],{'$or':_[_0x6ff8('0x2b')](_0x3fdfdc,function(_0x34541f){if(_0x34541f[_0x6ff8('0x2e')]!==_0x6ff8('0x3c')){var _0x5ac535={};_0x5ac535[_0x34541f[_0x6ff8('0x28')]]={'$like':'%'+_0x84d93[_0x6ff8('0x32')]['filter']+'%'};return _0x5ac535;}})});}_0xf8f9c5=_['merge']({},_0xf8f9c5,_0x84d93[_0x6ff8('0x3d')]);var _0x19144e={'where':_0xf8f9c5[_0x6ff8('0x3a')]};return db[_0x6ff8('0x2c')][_0x6ff8('0x1d')](_0x19144e)['then'](function(_0x3cb535){_0x3057d8[_0x6ff8('0x1d')]=_0x3cb535;if(_0x84d93[_0x6ff8('0x32')][_0x6ff8('0x3e')]){_0xf8f9c5['include']=[{'all':!![]}];}return db[_0x6ff8('0x2c')][_0x6ff8('0x3f')](_0xf8f9c5);})[_0x6ff8('0x24')](function(_0x476390){_0x3057d8[_0x6ff8('0x40')]=_0x476390;return _0x3057d8;})['then'](respondWithFilteredResult(_0x28fb94,_0xf8f9c5))[_0x6ff8('0x41')](handleError(_0x28fb94,null));};exports[_0x6ff8('0x42')]=function(_0x41c8ad,_0x26badd){var _0x57767b={'raw':![],'where':{'id':_0x41c8ad[_0x6ff8('0x43')]['id']}},_0x4f2208={};_0x4f2208[_0x6ff8('0x30')]=_[_0x6ff8('0x31')](db[_0x6ff8('0x2c')][_0x6ff8('0x2d')]);_0x4f2208[_0x6ff8('0x32')]=_[_0x6ff8('0x31')](_0x41c8ad[_0x6ff8('0x32')]);_0x4f2208[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x4f2208[_0x6ff8('0x30')],_0x4f2208[_0x6ff8('0x32')]);_0x57767b[_0x6ff8('0x35')]=_['intersection'](_0x4f2208[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x41c8ad[_0x6ff8('0x32')][_0x6ff8('0x44')]));_0x57767b[_0x6ff8('0x35')]=_0x57767b[_0x6ff8('0x35')][_0x6ff8('0x36')]?_0x57767b[_0x6ff8('0x35')]:_0x4f2208[_0x6ff8('0x30')];if(_0x41c8ad[_0x6ff8('0x32')][_0x6ff8('0x3e')]){_0x57767b[_0x6ff8('0x45')]=[{'all':!![]}];}_0x57767b=_[_0x6ff8('0x46')]({},_0x57767b,_0x41c8ad[_0x6ff8('0x3d')]);return db[_0x6ff8('0x2c')][_0x6ff8('0x47')](_0x57767b)[_0x6ff8('0x24')](handleEntityNotFound(_0x26badd,null))['then'](respondWithResult(_0x26badd,null))[_0x6ff8('0x41')](handleError(_0x26badd,null));};exports[_0x6ff8('0x48')]=function(_0xbf46c4,_0x5be820){return db['ZendeskConfiguration'][_0x6ff8('0x48')](_0xbf46c4[_0x6ff8('0x49')],{})[_0x6ff8('0x24')](respondWithResult(_0x5be820,0xc9))[_0x6ff8('0x41')](handleError(_0x5be820,null));};exports[_0x6ff8('0x23')]=function(_0x6b89be,_0x30969b){if(_0x6b89be[_0x6ff8('0x49')]['id']){delete _0x6b89be['body']['id'];}return db['ZendeskConfiguration'][_0x6ff8('0x47')]({'where':{'id':_0x6b89be[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x30969b,null))[_0x6ff8('0x24')](saveUpdates(_0x6b89be['body'],null))['then'](respondWithResult(_0x30969b,null))['catch'](handleError(_0x30969b,null));};exports['destroy']=function(_0x1dada7,_0x5158c5){return db[_0x6ff8('0x2c')]['find']({'where':{'id':_0x1dada7[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x5158c5,null))['then'](removeEntity(_0x5158c5,null))[_0x6ff8('0x41')](handleError(_0x5158c5,null));};exports['getFields']=function(_0x4980fc,_0x55d229,_0x555347){var _0x13a9af={};var _0x2c3c84={};var _0x5ec69d;var _0x13b9eb;return db[_0x6ff8('0x2c')]['findOne']({'where':{'id':_0x4980fc[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x55d229,null))[_0x6ff8('0x24')](function(_0x534f5c){if(_0x534f5c){_0x5ec69d=_0x534f5c;_0x2c3c84['model']=_[_0x6ff8('0x31')](db[_0x6ff8('0x4a')][_0x6ff8('0x2d')]);_0x2c3c84[_0x6ff8('0x32')]=_['keys'](_0x4980fc['query']);_0x2c3c84[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x2c3c84['model'],_0x2c3c84[_0x6ff8('0x32')]);_0x13a9af[_0x6ff8('0x35')]=_[_0x6ff8('0x34')](_0x2c3c84[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x4980fc[_0x6ff8('0x32')]['fields']));_0x13a9af[_0x6ff8('0x35')]=_0x13a9af['attributes']['length']?_0x13a9af['attributes']:_0x2c3c84['model'];_0x13a9af[_0x6ff8('0x4b')]=qs[_0x6ff8('0x39')](_0x4980fc['query'][_0x6ff8('0x39')]);_0x13a9af[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x4980fc[_0x6ff8('0x32')],_0x2c3c84[_0x6ff8('0x33')]));if(_0x4980fc[_0x6ff8('0x32')]['filter']){_0x13a9af[_0x6ff8('0x3a')]=_['merge'](_0x13a9af['where'],{'$or':_['map'](_0x13a9af[_0x6ff8('0x35')],function(_0x50d735){var _0x3829cd={};_0x3829cd[_0x50d735]={'$like':'%'+_0x4980fc['query']['filter']+'%'};return _0x3829cd;})});}_0x13a9af=_[_0x6ff8('0x46')]({},_0x13a9af,_0x4980fc['options']);return _0x5ec69d[_0x6ff8('0x4d')](_0x13a9af);}})[_0x6ff8('0x24')](function(_0x51ae7c){if(_0x51ae7c){_0x13b9eb=_0x51ae7c['length'];if(!_0x4980fc[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x13a9af[_0x6ff8('0x1e')]=qs[_0x6ff8('0x1e')](_0x4980fc[_0x6ff8('0x32')][_0x6ff8('0x1e')]);_0x13a9af[_0x6ff8('0x1b')]=qs['offset'](_0x4980fc['query'][_0x6ff8('0x1b')]);}return _0x5ec69d['getFields'](_0x13a9af);}})['then'](function(_0x39f170){if(_0x39f170){return _0x39f170?{'count':_0x13b9eb,'rows':_0x39f170}:null;}})[_0x6ff8('0x24')](respondWithResult(_0x55d229,null))['catch'](handleError(_0x55d229,null));};exports['getSubjects']=function(_0x2516b3,_0x3db2a8,_0x4679bf){var _0x22fc49={};var _0x12540e={};var _0x14c2f1;var _0x523c84;return db['ZendeskConfiguration'][_0x6ff8('0x4e')]({'where':{'id':_0x2516b3[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x3db2a8,null))[_0x6ff8('0x24')](function(_0x106321){if(_0x106321){_0x14c2f1=_0x106321;_0x12540e[_0x6ff8('0x30')]=_[_0x6ff8('0x31')](db[_0x6ff8('0x4a')][_0x6ff8('0x2d')]);_0x12540e[_0x6ff8('0x32')]=_[_0x6ff8('0x31')](_0x2516b3[_0x6ff8('0x32')]);_0x12540e[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x12540e[_0x6ff8('0x30')],_0x12540e[_0x6ff8('0x32')]);_0x22fc49[_0x6ff8('0x35')]=_['intersection'](_0x12540e[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x44')]));_0x22fc49['attributes']=_0x22fc49[_0x6ff8('0x35')][_0x6ff8('0x36')]?_0x22fc49['attributes']:_0x12540e[_0x6ff8('0x30')];_0x22fc49[_0x6ff8('0x4b')]=qs[_0x6ff8('0x39')](_0x2516b3['query'][_0x6ff8('0x39')]);_0x22fc49['where']=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x2516b3[_0x6ff8('0x32')],_0x12540e[_0x6ff8('0x33')]));if(_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x3b')]){_0x22fc49['where']=_[_0x6ff8('0x46')](_0x22fc49[_0x6ff8('0x3a')],{'$or':_['map'](_0x22fc49[_0x6ff8('0x35')],function(_0x40fb02){var _0x581090={};_0x581090[_0x40fb02]={'$like':'%'+_0x2516b3[_0x6ff8('0x32')]['filter']+'%'};return _0x581090;})});}_0x22fc49=_[_0x6ff8('0x46')]({},_0x22fc49,_0x2516b3[_0x6ff8('0x3d')]);return _0x14c2f1[_0x6ff8('0x4f')](_0x22fc49);}})[_0x6ff8('0x24')](function(_0x25c074){if(_0x25c074){_0x523c84=_0x25c074[_0x6ff8('0x36')];if(!_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x22fc49['limit']=qs[_0x6ff8('0x1e')](_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x1e')]);_0x22fc49[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x1b')]);}return _0x14c2f1[_0x6ff8('0x4f')](_0x22fc49);}})[_0x6ff8('0x24')](function(_0x42008a){if(_0x42008a){return _0x42008a?{'count':_0x523c84,'rows':_0x42008a}:null;}})[_0x6ff8('0x24')](respondWithResult(_0x3db2a8,null))[_0x6ff8('0x41')](handleError(_0x3db2a8,null));};exports[_0x6ff8('0x50')]=function(_0x3ebf15,_0x21b45b,_0x13dda2){var _0x4677cc={};var _0x5cb687={};var _0x2857b8;var _0x129dc3;return db[_0x6ff8('0x2c')][_0x6ff8('0x4e')]({'where':{'id':_0x3ebf15[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x21b45b,null))['then'](function(_0x4d56f7){if(_0x4d56f7){_0x2857b8=_0x4d56f7;_0x5cb687['model']=_[_0x6ff8('0x31')](db[_0x6ff8('0x4a')]['rawAttributes']);_0x5cb687[_0x6ff8('0x32')]=_['keys'](_0x3ebf15['query']);_0x5cb687[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x5cb687[_0x6ff8('0x30')],_0x5cb687['query']);_0x4677cc[_0x6ff8('0x35')]=_[_0x6ff8('0x34')](_0x5cb687[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x3ebf15[_0x6ff8('0x32')]['fields']));_0x4677cc[_0x6ff8('0x35')]=_0x4677cc[_0x6ff8('0x35')]['length']?_0x4677cc['attributes']:_0x5cb687[_0x6ff8('0x30')];_0x4677cc[_0x6ff8('0x4b')]=qs[_0x6ff8('0x39')](_0x3ebf15['query']['sort']);_0x4677cc[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x3ebf15[_0x6ff8('0x32')],_0x5cb687[_0x6ff8('0x33')]));if(_0x3ebf15[_0x6ff8('0x32')][_0x6ff8('0x3b')]){_0x4677cc[_0x6ff8('0x3a')]=_[_0x6ff8('0x46')](_0x4677cc[_0x6ff8('0x3a')],{'$or':_[_0x6ff8('0x2b')](_0x4677cc[_0x6ff8('0x35')],function(_0x4b47a5){var _0x4549c8={};_0x4549c8[_0x4b47a5]={'$like':'%'+_0x3ebf15[_0x6ff8('0x32')][_0x6ff8('0x3b')]+'%'};return _0x4549c8;})});}_0x4677cc=_['merge']({},_0x4677cc,_0x3ebf15[_0x6ff8('0x3d')]);return _0x2857b8['getDescriptions'](_0x4677cc);}})['then'](function(_0x437ba3){if(_0x437ba3){_0x129dc3=_0x437ba3[_0x6ff8('0x36')];if(!_0x3ebf15[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x4677cc[_0x6ff8('0x1e')]=qs[_0x6ff8('0x1e')](_0x3ebf15[_0x6ff8('0x32')]['limit']);_0x4677cc[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x3ebf15[_0x6ff8('0x32')]['offset']);}return _0x2857b8[_0x6ff8('0x50')](_0x4677cc);}})['then'](function(_0x796cc){if(_0x796cc){return _0x796cc?{'count':_0x129dc3,'rows':_0x796cc}:null;}})[_0x6ff8('0x24')](respondWithResult(_0x21b45b,null))['catch'](handleError(_0x21b45b,null));};exports[_0x6ff8('0x51')]=function(_0x457610,_0x14c1e3,_0x1cd55a){var _0x3db244={};var _0x4003a5={};var _0x2c46b5;var _0x3baae6;return db['ZendeskConfiguration'][_0x6ff8('0x4e')]({'where':{'id':_0x457610[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x14c1e3,null))[_0x6ff8('0x24')](function(_0x179000){if(_0x179000){_0x2c46b5=_0x179000;_0x4003a5[_0x6ff8('0x30')]=_['keys'](db[_0x6ff8('0x52')][_0x6ff8('0x2d')]);_0x4003a5[_0x6ff8('0x32')]=_[_0x6ff8('0x31')](_0x457610[_0x6ff8('0x32')]);_0x4003a5[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x4003a5['model'],_0x4003a5['query']);_0x3db244['attributes']=_[_0x6ff8('0x34')](_0x4003a5[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x457610[_0x6ff8('0x32')][_0x6ff8('0x44')]));_0x3db244[_0x6ff8('0x35')]=_0x3db244[_0x6ff8('0x35')]['length']?_0x3db244[_0x6ff8('0x35')]:_0x4003a5[_0x6ff8('0x30')];_0x3db244['order']=qs['sort'](_0x457610['query'][_0x6ff8('0x39')]);_0x3db244[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x457610[_0x6ff8('0x32')],_0x4003a5['filters']));if(_0x457610['query'][_0x6ff8('0x3b')]){_0x3db244[_0x6ff8('0x3a')]=_[_0x6ff8('0x46')](_0x3db244['where'],{'$or':_[_0x6ff8('0x2b')](_0x3db244[_0x6ff8('0x35')],function(_0x3e568f){var _0x30f6b1={};_0x30f6b1[_0x3e568f]={'$like':'%'+_0x457610[_0x6ff8('0x32')][_0x6ff8('0x3b')]+'%'};return _0x30f6b1;})});}_0x3db244=_['merge']({},_0x3db244,_0x457610[_0x6ff8('0x3d')]);return _0x2c46b5[_0x6ff8('0x51')](_0x3db244);}})[_0x6ff8('0x24')](function(_0x2ec373){if(_0x2ec373){_0x3baae6=_0x2ec373['length'];if(!_0x457610['query'][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x3db244[_0x6ff8('0x1e')]=qs[_0x6ff8('0x1e')](_0x457610[_0x6ff8('0x32')][_0x6ff8('0x1e')]);_0x3db244[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x457610[_0x6ff8('0x32')][_0x6ff8('0x1b')]);}return _0x2c46b5['getTags'](_0x3db244);}})[_0x6ff8('0x24')](function(_0x406a6f){if(_0x406a6f){return _0x406a6f?{'count':_0x3baae6,'rows':_0x406a6f}:null;}})['then'](respondWithResult(_0x14c1e3,null))[_0x6ff8('0x41')](handleError(_0x14c1e3,null));};exports[_0x6ff8('0x53')]=function(_0x4f32e3,_0x3ca94d,_0x1e5b10){if(_0x4f32e3[_0x6ff8('0x49')]['id']){delete _0x4f32e3[_0x6ff8('0x49')]['id'];}return db[_0x6ff8('0x2c')][_0x6ff8('0x4e')]({'where':{'id':_0x4f32e3[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x3ca94d,null))[_0x6ff8('0x24')](function(_0x5a596f){if(_0x5a596f){return _0x5a596f[_0x6ff8('0x53')](_0x4f32e3[_0x6ff8('0x49')]['ids']||[]);}return null;})[_0x6ff8('0x24')](respondWithResult(_0x3ca94d,null))['catch'](handleError(_0x3ca94d,null));};
\ No newline at end of file