Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index 6de6678..ea643b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcbb2=['length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','create','body','getFields','findOne','getSubjects','ZendeskField','nolimit','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','end','stack','name','index','map','ZendeskConfiguration','fieldName','model','query','filters','intersection','attributes','fields'];(function(_0x2e2d7f,_0x11e4d5){var _0x4021ac=function(_0xa724a7){while(--_0xa724a7){_0x2e2d7f['push'](_0x2e2d7f['shift']());}};_0x4021ac(++_0x11e4d5);}(_0xcbb2,0xd6));var _0x2cbb=function(_0x5377d6,_0x3b74f){_0x5377d6=_0x5377d6-0x0;var _0x435b97=_0xcbb2[_0x5377d6];return _0x435b97;};'use strict';var pdf=require(_0x2cbb('0x0'));var emlformat=require(_0x2cbb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2cbb('0x2'));var jsonpatch=require(_0x2cbb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2cbb('0x4'));var Mustache=require('mustache');var util=require(_0x2cbb('0x5'));var path=require('path');var sox=require(_0x2cbb('0x6'));var csv=require('to-csv');var ejs=require(_0x2cbb('0x7'));var fs=require('fs');var _=require(_0x2cbb('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2cbb('0x9'));var deskjs=require(_0x2cbb('0xa'));var toCsv=require(_0x2cbb('0xb'));var querystring=require(_0x2cbb('0xc'));var Papa=require('papaparse');var Redis=require(_0x2cbb('0xd'));var authService=require(_0x2cbb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2cbb('0xf'));var hardwareService=require(_0x2cbb('0x10'));var logger=require(_0x2cbb('0x11'))(_0x2cbb('0x12'));var utils=require(_0x2cbb('0x13'));var config=require(_0x2cbb('0x14'));var licenseUtil=require(_0x2cbb('0x15'));var db=require(_0x2cbb('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2cbb('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6b8dc3,_0x3fa991,_0x5edfe2,_0x131fd1){return new BPromise(function(_0x13d730,_0x244624){var _0x2106f6=_0x131fd1||client;return _0x2106f6[_0x2cbb('0x18')](_0x6b8dc3,_0x5edfe2)[_0x2cbb('0x19')](function(_0x39f83f){logger[_0x2cbb('0x1a')](_0x2cbb('0x1b'),_0x3fa991,_0x2cbb('0x1c'));logger[_0x2cbb('0x1d')](_0x2cbb('0x1e'),_0x3fa991,'request\x20sent',JSON[_0x2cbb('0x1f')](_0x39f83f));if(_0x39f83f[_0x2cbb('0x20')]){if(_0x39f83f[_0x2cbb('0x20')][_0x2cbb('0x21')]===0x1f4){logger[_0x2cbb('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3fa991,_0x39f83f[_0x2cbb('0x20')]['message']);return _0x244624(_0x39f83f[_0x2cbb('0x20')][_0x2cbb('0x22')]);}logger['error'](_0x2cbb('0x1b'),_0x3fa991,_0x39f83f[_0x2cbb('0x20')][_0x2cbb('0x22')]);return _0x13d730(_0x39f83f[_0x2cbb('0x20')]['message']);}else{logger[_0x2cbb('0x1a')](_0x2cbb('0x1b'),_0x3fa991,_0x2cbb('0x1c'));_0x13d730(_0x39f83f[_0x2cbb('0x23')][_0x2cbb('0x22')]);}})[_0x2cbb('0x24')](function(_0x4ace90){logger[_0x2cbb('0x20')](_0x2cbb('0x1b'),_0x3fa991,_0x4ace90);_0x244624(_0x4ace90);});});}function respondWithStatusCode(_0x2be020,_0x3f522b){_0x3f522b=_0x3f522b||0xcc;return function(_0x3e2a48){if(_0x3e2a48){return _0x2be020[_0x2cbb('0x25')](_0x3f522b);}return _0x2be020[_0x2cbb('0x26')](_0x3f522b)['end']();};}function respondWithResult(_0x595bac,_0x2d911e){_0x2d911e=_0x2d911e||0xc8;return function(_0x53103d){if(_0x53103d){return _0x595bac[_0x2cbb('0x26')](_0x2d911e)[_0x2cbb('0x27')](_0x53103d);}};}function respondWithFilteredResult(_0x144992,_0x8bd443){return function(_0x36ef1d){if(_0x36ef1d){var _0x898b0=_0x36ef1d[_0x2cbb('0x28')],_0x1d6ebc=_0x8bd443[_0x2cbb('0x29')],_0x58df86=_0x8bd443[_0x2cbb('0x29')]+_0x8bd443[_0x2cbb('0x2a')],_0x539125;if(_0x58df86>=_0x898b0){_0x58df86=_0x898b0;_0x539125=0xc8;}else{_0x539125=0xce;}_0x144992[_0x2cbb('0x26')](_0x539125);return _0x144992[_0x2cbb('0x2b')](_0x2cbb('0x2c'),_0x1d6ebc+'-'+_0x58df86+'/'+_0x898b0)[_0x2cbb('0x27')](_0x36ef1d);}return null;};}function patchUpdates(_0x1710cb){return function(_0x168e7b){try{jsonpatch[_0x2cbb('0x2d')](_0x168e7b,_0x1710cb,!![]);}catch(_0x5788e3){return BPromise[_0x2cbb('0x2e')](_0x5788e3);}return _0x168e7b['save']();};}function saveUpdates(_0x28675e,_0x3aab4d){return function(_0x27f0d7){if(_0x27f0d7){return _0x27f0d7[_0x2cbb('0x2f')](_0x28675e)[_0x2cbb('0x19')](function(_0x196a07){return _0x196a07;});}return null;};}function removeEntity(_0x10989b,_0x4fde00){return function(_0xfd88b8){if(_0xfd88b8){return _0xfd88b8[_0x2cbb('0x30')]()[_0x2cbb('0x19')](function(){_0x10989b[_0x2cbb('0x26')](0xcc)[_0x2cbb('0x31')]();});}};}function handleEntityNotFound(_0x4c537f,_0x503968){return function(_0x5be4ca){if(!_0x5be4ca){_0x4c537f[_0x2cbb('0x25')](0x194);}return _0x5be4ca;};}function handleError(_0x4d2ae5,_0x17118e){_0x17118e=_0x17118e||0x1f4;return function(_0x287511){logger[_0x2cbb('0x20')](_0x287511[_0x2cbb('0x32')]);if(_0x287511[_0x2cbb('0x33')]){delete _0x287511['name'];}_0x4d2ae5[_0x2cbb('0x26')](_0x17118e)['send'](_0x287511);};}exports[_0x2cbb('0x34')]=function(_0x191a6,_0x41d84f){var _0x221869={},_0x1563c2={},_0x4a7179={'count':0x0,'rows':[]};var _0x3f4d32=_[_0x2cbb('0x35')](db[_0x2cbb('0x36')]['rawAttributes'],function(_0x328b3d){return{'name':_0x328b3d[_0x2cbb('0x37')],'type':_0x328b3d['type']['key']};});_0x1563c2[_0x2cbb('0x38')]=_['map'](_0x3f4d32,'name');_0x1563c2['query']=_['keys'](_0x191a6[_0x2cbb('0x39')]);_0x1563c2[_0x2cbb('0x3a')]=_[_0x2cbb('0x3b')](_0x1563c2[_0x2cbb('0x38')],_0x1563c2[_0x2cbb('0x39')]);_0x221869[_0x2cbb('0x3c')]=_[_0x2cbb('0x3b')](_0x1563c2[_0x2cbb('0x38')],qs[_0x2cbb('0x3d')](_0x191a6[_0x2cbb('0x39')][_0x2cbb('0x3d')]));_0x221869['attributes']=_0x221869['attributes'][_0x2cbb('0x3e')]?_0x221869[_0x2cbb('0x3c')]:_0x1563c2['model'];if(!_0x191a6[_0x2cbb('0x39')][_0x2cbb('0x3f')]('nolimit')){_0x221869['limit']=qs[_0x2cbb('0x2a')](_0x191a6[_0x2cbb('0x39')][_0x2cbb('0x2a')]);_0x221869['offset']=qs['offset'](_0x191a6[_0x2cbb('0x39')][_0x2cbb('0x29')]);}_0x221869[_0x2cbb('0x40')]=qs[_0x2cbb('0x41')](_0x191a6[_0x2cbb('0x39')][_0x2cbb('0x41')]);_0x221869['where']=qs[_0x2cbb('0x3a')](_[_0x2cbb('0x42')](_0x191a6[_0x2cbb('0x39')],_0x1563c2[_0x2cbb('0x3a')]),_0x3f4d32);if(_0x191a6[_0x2cbb('0x39')]['filter']){_0x221869[_0x2cbb('0x43')]=_[_0x2cbb('0x44')](_0x221869['where'],{'$or':_['map'](_0x3f4d32,function(_0x441f62){if(_0x441f62[_0x2cbb('0x45')]!==_0x2cbb('0x46')){var _0x5ed055={};_0x5ed055[_0x441f62['name']]={'$like':'%'+_0x191a6[_0x2cbb('0x39')][_0x2cbb('0x47')]+'%'};return _0x5ed055;}})});}_0x221869=_[_0x2cbb('0x44')]({},_0x221869,_0x191a6[_0x2cbb('0x48')]);var _0x21d376={'where':_0x221869['where']};return db[_0x2cbb('0x36')]['count'](_0x21d376)[_0x2cbb('0x19')](function(_0x544614){_0x4a7179['count']=_0x544614;if(_0x191a6[_0x2cbb('0x39')][_0x2cbb('0x49')]){_0x221869[_0x2cbb('0x4a')]=[{'all':!![]}];}return db[_0x2cbb('0x36')][_0x2cbb('0x4b')](_0x221869);})[_0x2cbb('0x19')](function(_0xab3ac8){_0x4a7179['rows']=_0xab3ac8;return _0x4a7179;})['then'](respondWithFilteredResult(_0x41d84f,_0x221869))['catch'](handleError(_0x41d84f,null));};exports[_0x2cbb('0x4c')]=function(_0x34b62d,_0x3cd023){var _0xbb1822={'raw':![],'where':{'id':_0x34b62d[_0x2cbb('0x4d')]['id']}},_0x32edda={};_0x32edda[_0x2cbb('0x38')]=_[_0x2cbb('0x4e')](db[_0x2cbb('0x36')][_0x2cbb('0x4f')]);_0x32edda[_0x2cbb('0x39')]=_['keys'](_0x34b62d[_0x2cbb('0x39')]);_0x32edda[_0x2cbb('0x3a')]=_['intersection'](_0x32edda[_0x2cbb('0x38')],_0x32edda[_0x2cbb('0x39')]);_0xbb1822[_0x2cbb('0x3c')]=_['intersection'](_0x32edda[_0x2cbb('0x38')],qs['fields'](_0x34b62d[_0x2cbb('0x39')][_0x2cbb('0x3d')]));_0xbb1822['attributes']=_0xbb1822['attributes'][_0x2cbb('0x3e')]?_0xbb1822['attributes']:_0x32edda[_0x2cbb('0x38')];if(_0x34b62d[_0x2cbb('0x39')]['includeAll']){_0xbb1822[_0x2cbb('0x4a')]=[{'all':!![]}];}_0xbb1822=_['merge']({},_0xbb1822,_0x34b62d[_0x2cbb('0x48')]);return db[_0x2cbb('0x36')][_0x2cbb('0x50')](_0xbb1822)[_0x2cbb('0x19')](handleEntityNotFound(_0x3cd023,null))[_0x2cbb('0x19')](respondWithResult(_0x3cd023,null))[_0x2cbb('0x24')](handleError(_0x3cd023,null));};exports[_0x2cbb('0x51')]=function(_0x48dc51,_0x26a8fc){return db['ZendeskConfiguration']['create'](_0x48dc51[_0x2cbb('0x52')],{})[_0x2cbb('0x19')](respondWithResult(_0x26a8fc,0xc9))[_0x2cbb('0x24')](handleError(_0x26a8fc,null));};exports[_0x2cbb('0x2f')]=function(_0x399cea,_0x59d408){if(_0x399cea['body']['id']){delete _0x399cea[_0x2cbb('0x52')]['id'];}return db[_0x2cbb('0x36')][_0x2cbb('0x50')]({'where':{'id':_0x399cea[_0x2cbb('0x4d')]['id']}})[_0x2cbb('0x19')](handleEntityNotFound(_0x59d408,null))[_0x2cbb('0x19')](saveUpdates(_0x399cea[_0x2cbb('0x52')],null))['then'](respondWithResult(_0x59d408,null))[_0x2cbb('0x24')](handleError(_0x59d408,null));};exports[_0x2cbb('0x30')]=function(_0x45b441,_0x3c8e5b){return db[_0x2cbb('0x36')][_0x2cbb('0x50')]({'where':{'id':_0x45b441[_0x2cbb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3c8e5b,null))[_0x2cbb('0x19')](removeEntity(_0x3c8e5b,null))[_0x2cbb('0x24')](handleError(_0x3c8e5b,null));};exports[_0x2cbb('0x53')]=function(_0x4a8d28,_0x26c70d,_0x154f3e){var _0x2c4cd5={};var _0x1cf24d={};var _0x3dfa79;var _0x54862d;return db[_0x2cbb('0x36')][_0x2cbb('0x54')]({'where':{'id':_0x4a8d28['params']['id']}})['then'](handleEntityNotFound(_0x26c70d,null))['then'](function(_0x792908){if(_0x792908){_0x3dfa79=_0x792908;_0x1cf24d[_0x2cbb('0x38')]=_[_0x2cbb('0x4e')](db['ZendeskField']['rawAttributes']);_0x1cf24d[_0x2cbb('0x39')]=_['keys'](_0x4a8d28[_0x2cbb('0x39')]);_0x1cf24d[_0x2cbb('0x3a')]=_[_0x2cbb('0x3b')](_0x1cf24d[_0x2cbb('0x38')],_0x1cf24d['query']);_0x2c4cd5[_0x2cbb('0x3c')]=_['intersection'](_0x1cf24d['model'],qs[_0x2cbb('0x3d')](_0x4a8d28['query'][_0x2cbb('0x3d')]));_0x2c4cd5[_0x2cbb('0x3c')]=_0x2c4cd5[_0x2cbb('0x3c')][_0x2cbb('0x3e')]?_0x2c4cd5[_0x2cbb('0x3c')]:_0x1cf24d[_0x2cbb('0x38')];_0x2c4cd5[_0x2cbb('0x40')]=qs[_0x2cbb('0x41')](_0x4a8d28[_0x2cbb('0x39')][_0x2cbb('0x41')]);_0x2c4cd5[_0x2cbb('0x43')]=qs[_0x2cbb('0x3a')](_['pick'](_0x4a8d28['query'],_0x1cf24d['filters']));if(_0x4a8d28[_0x2cbb('0x39')][_0x2cbb('0x47')]){_0x2c4cd5[_0x2cbb('0x43')]=_[_0x2cbb('0x44')](_0x2c4cd5[_0x2cbb('0x43')],{'$or':_[_0x2cbb('0x35')](_0x2c4cd5[_0x2cbb('0x3c')],function(_0x5e6d52){var _0x38ea35={};_0x38ea35[_0x5e6d52]={'$like':'%'+_0x4a8d28['query'][_0x2cbb('0x47')]+'%'};return _0x38ea35;})});}_0x2c4cd5=_[_0x2cbb('0x44')]({},_0x2c4cd5,_0x4a8d28[_0x2cbb('0x48')]);return _0x3dfa79[_0x2cbb('0x53')](_0x2c4cd5);}})['then'](function(_0x10158c){if(_0x10158c){_0x54862d=_0x10158c[_0x2cbb('0x3e')];if(!_0x4a8d28[_0x2cbb('0x39')]['hasOwnProperty']('nolimit')){_0x2c4cd5['limit']=qs[_0x2cbb('0x2a')](_0x4a8d28[_0x2cbb('0x39')][_0x2cbb('0x2a')]);_0x2c4cd5[_0x2cbb('0x29')]=qs[_0x2cbb('0x29')](_0x4a8d28[_0x2cbb('0x39')][_0x2cbb('0x29')]);}return _0x3dfa79[_0x2cbb('0x53')](_0x2c4cd5);}})[_0x2cbb('0x19')](function(_0xe5770a){if(_0xe5770a){return _0xe5770a?{'count':_0x54862d,'rows':_0xe5770a}:null;}})[_0x2cbb('0x19')](respondWithResult(_0x26c70d,null))[_0x2cbb('0x24')](handleError(_0x26c70d,null));};exports[_0x2cbb('0x55')]=function(_0x72994a,_0x18d442,_0x479e5e){var _0x144372={};var _0x2ff9c5={};var _0x4c1496;var _0x17eaa9;return db[_0x2cbb('0x36')][_0x2cbb('0x54')]({'where':{'id':_0x72994a[_0x2cbb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x18d442,null))[_0x2cbb('0x19')](function(_0x251608){if(_0x251608){_0x4c1496=_0x251608;_0x2ff9c5[_0x2cbb('0x38')]=_['keys'](db[_0x2cbb('0x56')][_0x2cbb('0x4f')]);_0x2ff9c5['query']=_[_0x2cbb('0x4e')](_0x72994a[_0x2cbb('0x39')]);_0x2ff9c5['filters']=_['intersection'](_0x2ff9c5[_0x2cbb('0x38')],_0x2ff9c5['query']);_0x144372[_0x2cbb('0x3c')]=_[_0x2cbb('0x3b')](_0x2ff9c5[_0x2cbb('0x38')],qs[_0x2cbb('0x3d')](_0x72994a['query'][_0x2cbb('0x3d')]));_0x144372[_0x2cbb('0x3c')]=_0x144372[_0x2cbb('0x3c')][_0x2cbb('0x3e')]?_0x144372[_0x2cbb('0x3c')]:_0x2ff9c5[_0x2cbb('0x38')];_0x144372[_0x2cbb('0x40')]=qs[_0x2cbb('0x41')](_0x72994a[_0x2cbb('0x39')][_0x2cbb('0x41')]);_0x144372[_0x2cbb('0x43')]=qs[_0x2cbb('0x3a')](_[_0x2cbb('0x42')](_0x72994a[_0x2cbb('0x39')],_0x2ff9c5[_0x2cbb('0x3a')]));if(_0x72994a['query'][_0x2cbb('0x47')]){_0x144372[_0x2cbb('0x43')]=_[_0x2cbb('0x44')](_0x144372[_0x2cbb('0x43')],{'$or':_[_0x2cbb('0x35')](_0x144372['attributes'],function(_0x278d46){var _0x172695={};_0x172695[_0x278d46]={'$like':'%'+_0x72994a[_0x2cbb('0x39')][_0x2cbb('0x47')]+'%'};return _0x172695;})});}_0x144372=_[_0x2cbb('0x44')]({},_0x144372,_0x72994a['options']);return _0x4c1496[_0x2cbb('0x55')](_0x144372);}})['then'](function(_0x3c5526){if(_0x3c5526){_0x17eaa9=_0x3c5526[_0x2cbb('0x3e')];if(!_0x72994a[_0x2cbb('0x39')][_0x2cbb('0x3f')](_0x2cbb('0x57'))){_0x144372[_0x2cbb('0x2a')]=qs[_0x2cbb('0x2a')](_0x72994a['query'][_0x2cbb('0x2a')]);_0x144372[_0x2cbb('0x29')]=qs['offset'](_0x72994a[_0x2cbb('0x39')][_0x2cbb('0x29')]);}return _0x4c1496[_0x2cbb('0x55')](_0x144372);}})[_0x2cbb('0x19')](function(_0x53ac27){if(_0x53ac27){return _0x53ac27?{'count':_0x17eaa9,'rows':_0x53ac27}:null;}})['then'](respondWithResult(_0x18d442,null))[_0x2cbb('0x24')](handleError(_0x18d442,null));};exports[_0x2cbb('0x58')]=function(_0x2d604b,_0x2c95e0,_0x2a3104){var _0x3a44cd={};var _0x18375a={};var _0x2df2f0;var _0x48a0de;return db[_0x2cbb('0x36')]['findOne']({'where':{'id':_0x2d604b['params']['id']}})[_0x2cbb('0x19')](handleEntityNotFound(_0x2c95e0,null))['then'](function(_0x3e5ebc){if(_0x3e5ebc){_0x2df2f0=_0x3e5ebc;_0x18375a[_0x2cbb('0x38')]=_['keys'](db[_0x2cbb('0x56')]['rawAttributes']);_0x18375a[_0x2cbb('0x39')]=_[_0x2cbb('0x4e')](_0x2d604b['query']);_0x18375a[_0x2cbb('0x3a')]=_['intersection'](_0x18375a[_0x2cbb('0x38')],_0x18375a[_0x2cbb('0x39')]);_0x3a44cd[_0x2cbb('0x3c')]=_[_0x2cbb('0x3b')](_0x18375a[_0x2cbb('0x38')],qs[_0x2cbb('0x3d')](_0x2d604b['query']['fields']));_0x3a44cd[_0x2cbb('0x3c')]=_0x3a44cd[_0x2cbb('0x3c')][_0x2cbb('0x3e')]?_0x3a44cd[_0x2cbb('0x3c')]:_0x18375a[_0x2cbb('0x38')];_0x3a44cd[_0x2cbb('0x40')]=qs[_0x2cbb('0x41')](_0x2d604b[_0x2cbb('0x39')][_0x2cbb('0x41')]);_0x3a44cd['where']=qs[_0x2cbb('0x3a')](_['pick'](_0x2d604b[_0x2cbb('0x39')],_0x18375a[_0x2cbb('0x3a')]));if(_0x2d604b[_0x2cbb('0x39')]['filter']){_0x3a44cd['where']=_['merge'](_0x3a44cd[_0x2cbb('0x43')],{'$or':_['map'](_0x3a44cd[_0x2cbb('0x3c')],function(_0x5be4ff){var _0x3116b1={};_0x3116b1[_0x5be4ff]={'$like':'%'+_0x2d604b['query'][_0x2cbb('0x47')]+'%'};return _0x3116b1;})});}_0x3a44cd=_[_0x2cbb('0x44')]({},_0x3a44cd,_0x2d604b[_0x2cbb('0x48')]);return _0x2df2f0[_0x2cbb('0x58')](_0x3a44cd);}})[_0x2cbb('0x19')](function(_0x2ea855){if(_0x2ea855){_0x48a0de=_0x2ea855['length'];if(!_0x2d604b[_0x2cbb('0x39')][_0x2cbb('0x3f')](_0x2cbb('0x57'))){_0x3a44cd['limit']=qs[_0x2cbb('0x2a')](_0x2d604b[_0x2cbb('0x39')][_0x2cbb('0x2a')]);_0x3a44cd[_0x2cbb('0x29')]=qs[_0x2cbb('0x29')](_0x2d604b[_0x2cbb('0x39')][_0x2cbb('0x29')]);}return _0x2df2f0[_0x2cbb('0x58')](_0x3a44cd);}})[_0x2cbb('0x19')](function(_0x3fef11){if(_0x3fef11){return _0x3fef11?{'count':_0x48a0de,'rows':_0x3fef11}:null;}})[_0x2cbb('0x19')](respondWithResult(_0x2c95e0,null))[_0x2cbb('0x24')](handleError(_0x2c95e0,null));};exports[_0x2cbb('0x59')]=function(_0x8e3882,_0x832b90,_0x107f42){var _0x4a1a58={};var _0x380641={};var _0x53c426;var _0x400d7d;return db[_0x2cbb('0x36')]['findOne']({'where':{'id':_0x8e3882[_0x2cbb('0x4d')]['id']}})[_0x2cbb('0x19')](handleEntityNotFound(_0x832b90,null))['then'](function(_0x2b101a){if(_0x2b101a){_0x53c426=_0x2b101a;_0x380641['model']=_['keys'](db[_0x2cbb('0x5a')][_0x2cbb('0x4f')]);_0x380641['query']=_[_0x2cbb('0x4e')](_0x8e3882[_0x2cbb('0x39')]);_0x380641[_0x2cbb('0x3a')]=_['intersection'](_0x380641[_0x2cbb('0x38')],_0x380641[_0x2cbb('0x39')]);_0x4a1a58[_0x2cbb('0x3c')]=_[_0x2cbb('0x3b')](_0x380641[_0x2cbb('0x38')],qs[_0x2cbb('0x3d')](_0x8e3882['query'][_0x2cbb('0x3d')]));_0x4a1a58[_0x2cbb('0x3c')]=_0x4a1a58[_0x2cbb('0x3c')][_0x2cbb('0x3e')]?_0x4a1a58[_0x2cbb('0x3c')]:_0x380641['model'];_0x4a1a58[_0x2cbb('0x40')]=qs[_0x2cbb('0x41')](_0x8e3882[_0x2cbb('0x39')][_0x2cbb('0x41')]);_0x4a1a58[_0x2cbb('0x43')]=qs[_0x2cbb('0x3a')](_[_0x2cbb('0x42')](_0x8e3882[_0x2cbb('0x39')],_0x380641['filters']));if(_0x8e3882[_0x2cbb('0x39')][_0x2cbb('0x47')]){_0x4a1a58[_0x2cbb('0x43')]=_[_0x2cbb('0x44')](_0x4a1a58[_0x2cbb('0x43')],{'$or':_[_0x2cbb('0x35')](_0x4a1a58['attributes'],function(_0x531e59){var _0x5d23ae={};_0x5d23ae[_0x531e59]={'$like':'%'+_0x8e3882['query'][_0x2cbb('0x47')]+'%'};return _0x5d23ae;})});}_0x4a1a58=_[_0x2cbb('0x44')]({},_0x4a1a58,_0x8e3882[_0x2cbb('0x48')]);return _0x53c426[_0x2cbb('0x59')](_0x4a1a58);}})[_0x2cbb('0x19')](function(_0x4fecfe){if(_0x4fecfe){_0x400d7d=_0x4fecfe[_0x2cbb('0x3e')];if(!_0x8e3882['query']['hasOwnProperty'](_0x2cbb('0x57'))){_0x4a1a58['limit']=qs[_0x2cbb('0x2a')](_0x8e3882[_0x2cbb('0x39')][_0x2cbb('0x2a')]);_0x4a1a58[_0x2cbb('0x29')]=qs[_0x2cbb('0x29')](_0x8e3882[_0x2cbb('0x39')]['offset']);}return _0x53c426[_0x2cbb('0x59')](_0x4a1a58);}})[_0x2cbb('0x19')](function(_0xaaf885){if(_0xaaf885){return _0xaaf885?{'count':_0x400d7d,'rows':_0xaaf885}:null;}})[_0x2cbb('0x19')](respondWithResult(_0x832b90,null))[_0x2cbb('0x24')](handleError(_0x832b90,null));};exports['setTags']=function(_0x5454ca,_0x12e658,_0x1c0588){if(_0x5454ca[_0x2cbb('0x52')]['id']){delete _0x5454ca['body']['id'];}return db[_0x2cbb('0x36')][_0x2cbb('0x54')]({'where':{'id':_0x5454ca['params']['id']}})['then'](handleEntityNotFound(_0x12e658,null))['then'](function(_0x285921){if(_0x285921){return _0x285921[_0x2cbb('0x5b')](_0x5454ca[_0x2cbb('0x52')]['ids']||[]);}return null;})['then'](respondWithResult(_0x12e658,null))['catch'](handleError(_0x12e658,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