Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index afb0ec1..ea643b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x57e8=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','destroy','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','show','fields','create','body','update','find','params','findOne','ZendeskField','length','getFields','getSubjects','getDescriptions','getTags','Tag','ids','rimraf'];(function(_0x3aaab9,_0x211b0f){var _0x4a9e3b=function(_0x26e3a0){while(--_0x26e3a0){_0x3aaab9['push'](_0x3aaab9['shift']());}};_0x4a9e3b(++_0x211b0f);}(_0x57e8,0x113));var _0x857e=function(_0x533853,_0x5f351f){_0x533853=_0x533853-0x0;var _0x28f3e0=_0x57e8[_0x533853];return _0x28f3e0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x857e('0x0'));var zipdir=require(_0x857e('0x1'));var jsonpatch=require(_0x857e('0x2'));var rp=require('request-promise');var moment=require(_0x857e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x857e('0x4'));var util=require(_0x857e('0x5'));var path=require(_0x857e('0x6'));var sox=require(_0x857e('0x7'));var csv=require(_0x857e('0x8'));var ejs=require(_0x857e('0x9'));var fs=require('fs');var _=require(_0x857e('0xa'));var squel=require(_0x857e('0xb'));var crypto=require(_0x857e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x857e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x857e('0xe'));var Papa=require(_0x857e('0xf'));var Redis=require(_0x857e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x857e('0x11'));var as=require(_0x857e('0x12'));var hardwareService=require(_0x857e('0x13'));var logger=require(_0x857e('0x14'))(_0x857e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x857e('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x857e('0x17'));var client=jayson[_0x857e('0x18')][_0x857e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5f4fbd,_0x27bad6,_0x45b938,_0x469157){return new BPromise(function(_0x3f2c64,_0x2f66d6){var _0x3714df=_0x469157||client;return _0x3714df[_0x857e('0x1a')](_0x5f4fbd,_0x45b938)[_0x857e('0x1b')](function(_0x5894c5){logger[_0x857e('0x1c')](_0x857e('0x1d'),_0x27bad6,_0x857e('0x1e'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x27bad6,_0x857e('0x1e'),JSON[_0x857e('0x1f')](_0x5894c5));if(_0x5894c5[_0x857e('0x20')]){if(_0x5894c5[_0x857e('0x20')][_0x857e('0x21')]===0x1f4){logger[_0x857e('0x20')](_0x857e('0x1d'),_0x27bad6,_0x5894c5[_0x857e('0x20')][_0x857e('0x22')]);return _0x2f66d6(_0x5894c5['error'][_0x857e('0x22')]);}logger[_0x857e('0x20')](_0x857e('0x1d'),_0x27bad6,_0x5894c5['error']['message']);return _0x3f2c64(_0x5894c5[_0x857e('0x20')]['message']);}else{logger[_0x857e('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x27bad6,_0x857e('0x1e'));_0x3f2c64(_0x5894c5[_0x857e('0x23')][_0x857e('0x22')]);}})[_0x857e('0x24')](function(_0x4e722b){logger[_0x857e('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x27bad6,_0x4e722b);_0x2f66d6(_0x4e722b);});});}function respondWithStatusCode(_0x1a3430,_0x1d9114){_0x1d9114=_0x1d9114||0xcc;return function(_0x1b7846){if(_0x1b7846){return _0x1a3430[_0x857e('0x25')](_0x1d9114);}return _0x1a3430['status'](_0x1d9114)[_0x857e('0x26')]();};}function respondWithResult(_0x983266,_0x2b3287){_0x2b3287=_0x2b3287||0xc8;return function(_0x4dc63c){if(_0x4dc63c){return _0x983266[_0x857e('0x27')](_0x2b3287)['json'](_0x4dc63c);}};}function respondWithFilteredResult(_0x4d3975,_0x5b2a48){return function(_0x427b13){if(_0x427b13){var _0x3498c1=_0x427b13['count'],_0x4b6438=_0x5b2a48[_0x857e('0x28')],_0x302072=_0x5b2a48['offset']+_0x5b2a48[_0x857e('0x29')],_0x102648;if(_0x302072>=_0x3498c1){_0x302072=_0x3498c1;_0x102648=0xc8;}else{_0x102648=0xce;}_0x4d3975[_0x857e('0x27')](_0x102648);return _0x4d3975[_0x857e('0x2a')](_0x857e('0x2b'),_0x4b6438+'-'+_0x302072+'/'+_0x3498c1)[_0x857e('0x2c')](_0x427b13);}return null;};}function patchUpdates(_0x145cd7){return function(_0x371e68){try{jsonpatch[_0x857e('0x2d')](_0x371e68,_0x145cd7,!![]);}catch(_0x2efb80){return BPromise[_0x857e('0x2e')](_0x2efb80);}return _0x371e68[_0x857e('0x2f')]();};}function saveUpdates(_0x421e64,_0x5500ee){return function(_0x2af3c1){if(_0x2af3c1){return _0x2af3c1['update'](_0x421e64)[_0x857e('0x1b')](function(_0x25db28){return _0x25db28;});}return null;};}function removeEntity(_0x19f8bb,_0x46c379){return function(_0x31b7b8){if(_0x31b7b8){return _0x31b7b8[_0x857e('0x30')]()['then'](function(){_0x19f8bb[_0x857e('0x27')](0xcc)[_0x857e('0x26')]();});}};}function handleEntityNotFound(_0x5f35e8,_0x5b435a){return function(_0xf16ffa){if(!_0xf16ffa){_0x5f35e8[_0x857e('0x25')](0x194);}return _0xf16ffa;};}function handleError(_0x298f5c,_0x274ee8){_0x274ee8=_0x274ee8||0x1f4;return function(_0x482fa3){logger[_0x857e('0x20')](_0x482fa3['stack']);if(_0x482fa3[_0x857e('0x31')]){delete _0x482fa3[_0x857e('0x31')];}_0x298f5c[_0x857e('0x27')](_0x274ee8)['send'](_0x482fa3);};}exports[_0x857e('0x32')]=function(_0x3941cc,_0x535782){var _0x2d29cb={},_0x3c90e2={},_0x4d1d63={'count':0x0,'rows':[]};var _0x1fce9b=_[_0x857e('0x33')](db[_0x857e('0x34')][_0x857e('0x35')],function(_0x45a2bf){return{'name':_0x45a2bf[_0x857e('0x36')],'type':_0x45a2bf[_0x857e('0x37')]['key']};});_0x3c90e2[_0x857e('0x38')]=_[_0x857e('0x33')](_0x1fce9b,'name');_0x3c90e2['query']=_[_0x857e('0x39')](_0x3941cc[_0x857e('0x3a')]);_0x3c90e2[_0x857e('0x3b')]=_['intersection'](_0x3c90e2['model'],_0x3c90e2[_0x857e('0x3a')]);_0x2d29cb['attributes']=_[_0x857e('0x3c')](_0x3c90e2[_0x857e('0x38')],qs['fields'](_0x3941cc['query']['fields']));_0x2d29cb[_0x857e('0x3d')]=_0x2d29cb[_0x857e('0x3d')]['length']?_0x2d29cb[_0x857e('0x3d')]:_0x3c90e2[_0x857e('0x38')];if(!_0x3941cc[_0x857e('0x3a')][_0x857e('0x3e')](_0x857e('0x3f'))){_0x2d29cb['limit']=qs[_0x857e('0x29')](_0x3941cc[_0x857e('0x3a')]['limit']);_0x2d29cb[_0x857e('0x28')]=qs[_0x857e('0x28')](_0x3941cc['query'][_0x857e('0x28')]);}_0x2d29cb[_0x857e('0x40')]=qs['sort'](_0x3941cc[_0x857e('0x3a')][_0x857e('0x41')]);_0x2d29cb[_0x857e('0x42')]=qs[_0x857e('0x3b')](_[_0x857e('0x43')](_0x3941cc[_0x857e('0x3a')],_0x3c90e2['filters']),_0x1fce9b);if(_0x3941cc[_0x857e('0x3a')][_0x857e('0x44')]){_0x2d29cb[_0x857e('0x42')]=_['merge'](_0x2d29cb['where'],{'$or':_[_0x857e('0x33')](_0x1fce9b,function(_0x382edb){if(_0x382edb[_0x857e('0x37')]!==_0x857e('0x45')){var _0x485a35={};_0x485a35[_0x382edb[_0x857e('0x31')]]={'$like':'%'+_0x3941cc['query'][_0x857e('0x44')]+'%'};return _0x485a35;}})});}_0x2d29cb=_[_0x857e('0x46')]({},_0x2d29cb,_0x3941cc[_0x857e('0x47')]);var _0x15e49e={'where':_0x2d29cb[_0x857e('0x42')]};return db[_0x857e('0x34')]['count'](_0x15e49e)[_0x857e('0x1b')](function(_0xeb026){_0x4d1d63[_0x857e('0x48')]=_0xeb026;if(_0x3941cc[_0x857e('0x3a')]['includeAll']){_0x2d29cb[_0x857e('0x49')]=[{'all':!![]}];}return db[_0x857e('0x34')][_0x857e('0x4a')](_0x2d29cb);})[_0x857e('0x1b')](function(_0x2c6fbf){_0x4d1d63[_0x857e('0x4b')]=_0x2c6fbf;return _0x4d1d63;})[_0x857e('0x1b')](respondWithFilteredResult(_0x535782,_0x2d29cb))[_0x857e('0x24')](handleError(_0x535782,null));};exports[_0x857e('0x4c')]=function(_0x5f0965,_0x1bfb02){var _0x3837eb={'raw':![],'where':{'id':_0x5f0965['params']['id']}},_0x8d0419={};_0x8d0419['model']=_[_0x857e('0x39')](db[_0x857e('0x34')][_0x857e('0x35')]);_0x8d0419[_0x857e('0x3a')]=_['keys'](_0x5f0965['query']);_0x8d0419[_0x857e('0x3b')]=_[_0x857e('0x3c')](_0x8d0419['model'],_0x8d0419[_0x857e('0x3a')]);_0x3837eb[_0x857e('0x3d')]=_[_0x857e('0x3c')](_0x8d0419[_0x857e('0x38')],qs[_0x857e('0x4d')](_0x5f0965[_0x857e('0x3a')]['fields']));_0x3837eb[_0x857e('0x3d')]=_0x3837eb[_0x857e('0x3d')]['length']?_0x3837eb[_0x857e('0x3d')]:_0x8d0419['model'];if(_0x5f0965[_0x857e('0x3a')]['includeAll']){_0x3837eb['include']=[{'all':!![]}];}_0x3837eb=_[_0x857e('0x46')]({},_0x3837eb,_0x5f0965[_0x857e('0x47')]);return db[_0x857e('0x34')]['find'](_0x3837eb)['then'](handleEntityNotFound(_0x1bfb02,null))['then'](respondWithResult(_0x1bfb02,null))[_0x857e('0x24')](handleError(_0x1bfb02,null));};exports[_0x857e('0x4e')]=function(_0x3658a5,_0x1aa6fb){return db[_0x857e('0x34')]['create'](_0x3658a5[_0x857e('0x4f')],{})[_0x857e('0x1b')](respondWithResult(_0x1aa6fb,0xc9))[_0x857e('0x24')](handleError(_0x1aa6fb,null));};exports[_0x857e('0x50')]=function(_0x38fff8,_0x3f72eb){if(_0x38fff8[_0x857e('0x4f')]['id']){delete _0x38fff8[_0x857e('0x4f')]['id'];}return db['ZendeskConfiguration'][_0x857e('0x51')]({'where':{'id':_0x38fff8[_0x857e('0x52')]['id']}})[_0x857e('0x1b')](handleEntityNotFound(_0x3f72eb,null))[_0x857e('0x1b')](saveUpdates(_0x38fff8[_0x857e('0x4f')],null))[_0x857e('0x1b')](respondWithResult(_0x3f72eb,null))[_0x857e('0x24')](handleError(_0x3f72eb,null));};exports[_0x857e('0x30')]=function(_0x48e967,_0x18e7b3){return db[_0x857e('0x34')][_0x857e('0x51')]({'where':{'id':_0x48e967['params']['id']}})[_0x857e('0x1b')](handleEntityNotFound(_0x18e7b3,null))[_0x857e('0x1b')](removeEntity(_0x18e7b3,null))['catch'](handleError(_0x18e7b3,null));};exports['getFields']=function(_0xe064f,_0x4d67dd,_0x34c614){var _0x5198e2={};var _0x4172c2={};var _0x10f463;var _0x2c8609;return db[_0x857e('0x34')][_0x857e('0x53')]({'where':{'id':_0xe064f[_0x857e('0x52')]['id']}})[_0x857e('0x1b')](handleEntityNotFound(_0x4d67dd,null))[_0x857e('0x1b')](function(_0x469b78){if(_0x469b78){_0x10f463=_0x469b78;_0x4172c2[_0x857e('0x38')]=_[_0x857e('0x39')](db[_0x857e('0x54')]['rawAttributes']);_0x4172c2[_0x857e('0x3a')]=_['keys'](_0xe064f[_0x857e('0x3a')]);_0x4172c2[_0x857e('0x3b')]=_[_0x857e('0x3c')](_0x4172c2['model'],_0x4172c2['query']);_0x5198e2[_0x857e('0x3d')]=_[_0x857e('0x3c')](_0x4172c2['model'],qs[_0x857e('0x4d')](_0xe064f[_0x857e('0x3a')][_0x857e('0x4d')]));_0x5198e2[_0x857e('0x3d')]=_0x5198e2['attributes'][_0x857e('0x55')]?_0x5198e2[_0x857e('0x3d')]:_0x4172c2[_0x857e('0x38')];_0x5198e2['order']=qs['sort'](_0xe064f['query'][_0x857e('0x41')]);_0x5198e2['where']=qs[_0x857e('0x3b')](_[_0x857e('0x43')](_0xe064f['query'],_0x4172c2['filters']));if(_0xe064f['query']['filter']){_0x5198e2[_0x857e('0x42')]=_[_0x857e('0x46')](_0x5198e2[_0x857e('0x42')],{'$or':_[_0x857e('0x33')](_0x5198e2[_0x857e('0x3d')],function(_0x667a27){var _0x18f459={};_0x18f459[_0x667a27]={'$like':'%'+_0xe064f[_0x857e('0x3a')][_0x857e('0x44')]+'%'};return _0x18f459;})});}_0x5198e2=_[_0x857e('0x46')]({},_0x5198e2,_0xe064f[_0x857e('0x47')]);return _0x10f463[_0x857e('0x56')](_0x5198e2);}})[_0x857e('0x1b')](function(_0x46ce71){if(_0x46ce71){_0x2c8609=_0x46ce71[_0x857e('0x55')];if(!_0xe064f['query'][_0x857e('0x3e')]('nolimit')){_0x5198e2[_0x857e('0x29')]=qs[_0x857e('0x29')](_0xe064f[_0x857e('0x3a')][_0x857e('0x29')]);_0x5198e2[_0x857e('0x28')]=qs['offset'](_0xe064f[_0x857e('0x3a')]['offset']);}return _0x10f463[_0x857e('0x56')](_0x5198e2);}})[_0x857e('0x1b')](function(_0xa92fa3){if(_0xa92fa3){return _0xa92fa3?{'count':_0x2c8609,'rows':_0xa92fa3}:null;}})[_0x857e('0x1b')](respondWithResult(_0x4d67dd,null))[_0x857e('0x24')](handleError(_0x4d67dd,null));};exports[_0x857e('0x57')]=function(_0x1cbce3,_0x121b0a,_0x3948eb){var _0x1c8cf0={};var _0xa1475f={};var _0x20b9d2;var _0x295eca;return db[_0x857e('0x34')][_0x857e('0x53')]({'where':{'id':_0x1cbce3[_0x857e('0x52')]['id']}})[_0x857e('0x1b')](handleEntityNotFound(_0x121b0a,null))[_0x857e('0x1b')](function(_0x17a0d7){if(_0x17a0d7){_0x20b9d2=_0x17a0d7;_0xa1475f[_0x857e('0x38')]=_[_0x857e('0x39')](db['ZendeskField']['rawAttributes']);_0xa1475f[_0x857e('0x3a')]=_[_0x857e('0x39')](_0x1cbce3[_0x857e('0x3a')]);_0xa1475f['filters']=_[_0x857e('0x3c')](_0xa1475f[_0x857e('0x38')],_0xa1475f['query']);_0x1c8cf0[_0x857e('0x3d')]=_[_0x857e('0x3c')](_0xa1475f['model'],qs[_0x857e('0x4d')](_0x1cbce3[_0x857e('0x3a')][_0x857e('0x4d')]));_0x1c8cf0[_0x857e('0x3d')]=_0x1c8cf0['attributes'][_0x857e('0x55')]?_0x1c8cf0['attributes']:_0xa1475f['model'];_0x1c8cf0[_0x857e('0x40')]=qs[_0x857e('0x41')](_0x1cbce3[_0x857e('0x3a')][_0x857e('0x41')]);_0x1c8cf0['where']=qs[_0x857e('0x3b')](_[_0x857e('0x43')](_0x1cbce3[_0x857e('0x3a')],_0xa1475f[_0x857e('0x3b')]));if(_0x1cbce3['query']['filter']){_0x1c8cf0[_0x857e('0x42')]=_[_0x857e('0x46')](_0x1c8cf0[_0x857e('0x42')],{'$or':_[_0x857e('0x33')](_0x1c8cf0[_0x857e('0x3d')],function(_0x307dc0){var _0x18762b={};_0x18762b[_0x307dc0]={'$like':'%'+_0x1cbce3['query'][_0x857e('0x44')]+'%'};return _0x18762b;})});}_0x1c8cf0=_['merge']({},_0x1c8cf0,_0x1cbce3[_0x857e('0x47')]);return _0x20b9d2['getSubjects'](_0x1c8cf0);}})[_0x857e('0x1b')](function(_0xed4b4b){if(_0xed4b4b){_0x295eca=_0xed4b4b[_0x857e('0x55')];if(!_0x1cbce3[_0x857e('0x3a')][_0x857e('0x3e')](_0x857e('0x3f'))){_0x1c8cf0[_0x857e('0x29')]=qs[_0x857e('0x29')](_0x1cbce3[_0x857e('0x3a')][_0x857e('0x29')]);_0x1c8cf0[_0x857e('0x28')]=qs[_0x857e('0x28')](_0x1cbce3[_0x857e('0x3a')][_0x857e('0x28')]);}return _0x20b9d2[_0x857e('0x57')](_0x1c8cf0);}})[_0x857e('0x1b')](function(_0x3c05d9){if(_0x3c05d9){return _0x3c05d9?{'count':_0x295eca,'rows':_0x3c05d9}:null;}})['then'](respondWithResult(_0x121b0a,null))[_0x857e('0x24')](handleError(_0x121b0a,null));};exports[_0x857e('0x58')]=function(_0x1196ac,_0x290e5d,_0x1dfaf8){var _0x574596={};var _0x9a13f={};var _0x122c95;var _0x33636f;return db[_0x857e('0x34')][_0x857e('0x53')]({'where':{'id':_0x1196ac[_0x857e('0x52')]['id']}})[_0x857e('0x1b')](handleEntityNotFound(_0x290e5d,null))[_0x857e('0x1b')](function(_0x125f2f){if(_0x125f2f){_0x122c95=_0x125f2f;_0x9a13f['model']=_[_0x857e('0x39')](db['ZendeskField'][_0x857e('0x35')]);_0x9a13f[_0x857e('0x3a')]=_[_0x857e('0x39')](_0x1196ac[_0x857e('0x3a')]);_0x9a13f[_0x857e('0x3b')]=_['intersection'](_0x9a13f[_0x857e('0x38')],_0x9a13f[_0x857e('0x3a')]);_0x574596[_0x857e('0x3d')]=_[_0x857e('0x3c')](_0x9a13f['model'],qs[_0x857e('0x4d')](_0x1196ac[_0x857e('0x3a')][_0x857e('0x4d')]));_0x574596['attributes']=_0x574596[_0x857e('0x3d')]['length']?_0x574596[_0x857e('0x3d')]:_0x9a13f[_0x857e('0x38')];_0x574596[_0x857e('0x40')]=qs[_0x857e('0x41')](_0x1196ac[_0x857e('0x3a')]['sort']);_0x574596[_0x857e('0x42')]=qs['filters'](_[_0x857e('0x43')](_0x1196ac[_0x857e('0x3a')],_0x9a13f[_0x857e('0x3b')]));if(_0x1196ac['query'][_0x857e('0x44')]){_0x574596[_0x857e('0x42')]=_[_0x857e('0x46')](_0x574596['where'],{'$or':_[_0x857e('0x33')](_0x574596[_0x857e('0x3d')],function(_0x4e5373){var _0x3f7a0e={};_0x3f7a0e[_0x4e5373]={'$like':'%'+_0x1196ac['query']['filter']+'%'};return _0x3f7a0e;})});}_0x574596=_['merge']({},_0x574596,_0x1196ac['options']);return _0x122c95[_0x857e('0x58')](_0x574596);}})[_0x857e('0x1b')](function(_0x2fbedb){if(_0x2fbedb){_0x33636f=_0x2fbedb[_0x857e('0x55')];if(!_0x1196ac[_0x857e('0x3a')]['hasOwnProperty'](_0x857e('0x3f'))){_0x574596[_0x857e('0x29')]=qs[_0x857e('0x29')](_0x1196ac[_0x857e('0x3a')][_0x857e('0x29')]);_0x574596[_0x857e('0x28')]=qs[_0x857e('0x28')](_0x1196ac[_0x857e('0x3a')]['offset']);}return _0x122c95[_0x857e('0x58')](_0x574596);}})[_0x857e('0x1b')](function(_0x415ac9){if(_0x415ac9){return _0x415ac9?{'count':_0x33636f,'rows':_0x415ac9}:null;}})[_0x857e('0x1b')](respondWithResult(_0x290e5d,null))[_0x857e('0x24')](handleError(_0x290e5d,null));};exports[_0x857e('0x59')]=function(_0x51ea29,_0x35c785,_0x373b30){var _0x3436d4={};var _0x180f07={};var _0x2f8d23;var _0xea2c56;return db[_0x857e('0x34')][_0x857e('0x53')]({'where':{'id':_0x51ea29[_0x857e('0x52')]['id']}})[_0x857e('0x1b')](handleEntityNotFound(_0x35c785,null))[_0x857e('0x1b')](function(_0x23ba27){if(_0x23ba27){_0x2f8d23=_0x23ba27;_0x180f07['model']=_['keys'](db[_0x857e('0x5a')][_0x857e('0x35')]);_0x180f07['query']=_[_0x857e('0x39')](_0x51ea29['query']);_0x180f07[_0x857e('0x3b')]=_['intersection'](_0x180f07[_0x857e('0x38')],_0x180f07[_0x857e('0x3a')]);_0x3436d4[_0x857e('0x3d')]=_[_0x857e('0x3c')](_0x180f07[_0x857e('0x38')],qs[_0x857e('0x4d')](_0x51ea29[_0x857e('0x3a')]['fields']));_0x3436d4[_0x857e('0x3d')]=_0x3436d4[_0x857e('0x3d')][_0x857e('0x55')]?_0x3436d4[_0x857e('0x3d')]:_0x180f07[_0x857e('0x38')];_0x3436d4[_0x857e('0x40')]=qs[_0x857e('0x41')](_0x51ea29[_0x857e('0x3a')][_0x857e('0x41')]);_0x3436d4[_0x857e('0x42')]=qs['filters'](_[_0x857e('0x43')](_0x51ea29[_0x857e('0x3a')],_0x180f07['filters']));if(_0x51ea29[_0x857e('0x3a')][_0x857e('0x44')]){_0x3436d4['where']=_[_0x857e('0x46')](_0x3436d4[_0x857e('0x42')],{'$or':_[_0x857e('0x33')](_0x3436d4[_0x857e('0x3d')],function(_0x34b326){var _0xd90180={};_0xd90180[_0x34b326]={'$like':'%'+_0x51ea29[_0x857e('0x3a')][_0x857e('0x44')]+'%'};return _0xd90180;})});}_0x3436d4=_[_0x857e('0x46')]({},_0x3436d4,_0x51ea29['options']);return _0x2f8d23['getTags'](_0x3436d4);}})[_0x857e('0x1b')](function(_0x3a4d96){if(_0x3a4d96){_0xea2c56=_0x3a4d96[_0x857e('0x55')];if(!_0x51ea29[_0x857e('0x3a')][_0x857e('0x3e')]('nolimit')){_0x3436d4[_0x857e('0x29')]=qs[_0x857e('0x29')](_0x51ea29[_0x857e('0x3a')][_0x857e('0x29')]);_0x3436d4['offset']=qs[_0x857e('0x28')](_0x51ea29['query'][_0x857e('0x28')]);}return _0x2f8d23['getTags'](_0x3436d4);}})['then'](function(_0x1491bf){if(_0x1491bf){return _0x1491bf?{'count':_0xea2c56,'rows':_0x1491bf}:null;}})[_0x857e('0x1b')](respondWithResult(_0x35c785,null))[_0x857e('0x24')](handleError(_0x35c785,null));};exports['setTags']=function(_0x50cc7d,_0x2f187b,_0x17c6ef){if(_0x50cc7d['body']['id']){delete _0x50cc7d[_0x857e('0x4f')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x50cc7d[_0x857e('0x52')]['id']}})[_0x857e('0x1b')](handleEntityNotFound(_0x2f187b,null))[_0x857e('0x1b')](function(_0x36cf97){if(_0x36cf97){return _0x36cf97['setTags'](_0x50cc7d[_0x857e('0x4f')][_0x857e('0x5b')]||[]);}return null;})[_0x857e('0x1b')](respondWithResult(_0x2f187b,null))['catch'](handleError(_0x2f187b,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