Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 4423e73..b9de5be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x210b=['error','message','result','catch','sendStatus','status','end','limit','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','type','VIRTUAL','options','count','include','rows','params','keys','includeAll','find','create','body','FreshdeskField','getFields','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x210b,0xfa));var _0xb210=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x210b[_0x18a436];return _0x5c2cf8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb210('0x0'));var rimraf=require(_0xb210('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb210('0x2'));var rp=require(_0xb210('0x3'));var moment=require(_0xb210('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb210('0x5'));var util=require('util');var path=require(_0xb210('0x6'));var sox=require('sox');var csv=require(_0xb210('0x7'));var ejs=require(_0xb210('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb210('0x9'));var crypto=require(_0xb210('0xa'));var jsforce=require(_0xb210('0xb'));var deskjs=require(_0xb210('0xc'));var toCsv=require(_0xb210('0x7'));var querystring=require(_0xb210('0xd'));var Papa=require(_0xb210('0xe'));var Redis=require(_0xb210('0xf'));var authService=require(_0xb210('0x10'));var qs=require(_0xb210('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb210('0x12'));var utils=require(_0xb210('0x13'));var config=require('../../config/environment');var db=require(_0xb210('0x14'))['db'];var jayson=require(_0xb210('0x15'));var client=jayson[_0xb210('0x16')][_0xb210('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4c2707,_0x189d4b,_0x395a74){if(_0x395a74){var _0x1ae717=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ae717[_0xb210('0x18')](_0x189d4b)){return _0x4c2707;}else{throw new db[(_0xb210('0x19'))][(_0xb210('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4c2707;}}function respondWithRpcPromise(_0x5b6e38,_0x3725a6,_0x4eafc1,_0x3a1898){return new BPromise(function(_0x12000a,_0x21c1db){var _0x15871d=_0x3a1898||client;return _0x15871d[_0xb210('0x1b')](_0x5b6e38,_0x4eafc1)[_0xb210('0x1c')](function(_0x25245c){logger[_0xb210('0x1d')](_0xb210('0x1e'),_0x3725a6,_0xb210('0x1f'));logger[_0xb210('0x20')](_0xb210('0x21'),_0x3725a6,'request\x20sent',JSON[_0xb210('0x22')](_0x25245c));if(_0x25245c[_0xb210('0x23')]){if(_0x25245c['error']['code']===0x1f4){logger[_0xb210('0x23')](_0xb210('0x1e'),_0x3725a6,_0x25245c[_0xb210('0x23')]['message']);return _0x21c1db(_0x25245c[_0xb210('0x23')][_0xb210('0x24')]);}logger['error'](_0xb210('0x1e'),_0x3725a6,_0x25245c[_0xb210('0x23')][_0xb210('0x24')]);return _0x12000a(_0x25245c[_0xb210('0x23')][_0xb210('0x24')]);}else{logger[_0xb210('0x1d')](_0xb210('0x1e'),_0x3725a6,_0xb210('0x1f'));_0x12000a(_0x25245c[_0xb210('0x25')]['message']);}})[_0xb210('0x26')](function(_0x4cf5fb){logger['error'](_0xb210('0x1e'),_0x3725a6,_0x4cf5fb);_0x21c1db(_0x4cf5fb);});});}function respondWithStatusCode(_0x1c28c4,_0x48e195){_0x48e195=_0x48e195||0xcc;return function(_0x3d7e28){if(_0x3d7e28){return _0x1c28c4[_0xb210('0x27')](_0x48e195);}return _0x1c28c4[_0xb210('0x28')](_0x48e195)[_0xb210('0x29')]();};}function respondWithResult(_0x4bb10b,_0x1da3d5){_0x1da3d5=_0x1da3d5||0xc8;return function(_0x4ac5b0){if(_0x4ac5b0){return _0x4bb10b[_0xb210('0x28')](_0x1da3d5)['json'](_0x4ac5b0);}};}function respondWithFilteredResult(_0x47ac43,_0x1a700f){return function(_0x23d449){if(_0x23d449){var _0x282535=_0x23d449['count'],_0x4a61a0=_0x1a700f['offset'],_0xaa89f2=_0x1a700f['offset']+_0x1a700f[_0xb210('0x2a')],_0x154558;if(_0xaa89f2>=_0x282535){_0xaa89f2=_0x282535;_0x154558=0xc8;}else{_0x154558=0xce;}_0x47ac43[_0xb210('0x28')](_0x154558);return _0x47ac43[_0xb210('0x2b')](_0xb210('0x2c'),_0x4a61a0+'-'+_0xaa89f2+'/'+_0x282535)[_0xb210('0x2d')](_0x23d449);}return null;};}function patchUpdates(_0x59d17c){return function(_0x44a384){try{jsonpatch[_0xb210('0x2e')](_0x44a384,_0x59d17c,!![]);}catch(_0x1b4c03){return BPromise[_0xb210('0x2f')](_0x1b4c03);}return _0x44a384['save']();};}function saveUpdates(_0x109369,_0x46572f){return function(_0x31d847){if(_0x31d847){return _0x31d847[_0xb210('0x30')](_0x109369)['then'](function(_0x1407c4){return _0x1407c4;});}return null;};}function removeEntity(_0x3ff072,_0x585146){return function(_0x430f41){if(_0x430f41){return _0x430f41[_0xb210('0x31')]()['then'](function(){_0x3ff072[_0xb210('0x28')](0xcc)[_0xb210('0x29')]();});}};}function handleEntityNotFound(_0x36fc5a,_0x5650fa){return function(_0x14a45d){if(!_0x14a45d){_0x36fc5a[_0xb210('0x27')](0x194);}return _0x14a45d;};}function handleError(_0x1c203a,_0x3bfac3){_0x3bfac3=_0x3bfac3||0x1f4;return function(_0x207372){logger[_0xb210('0x23')](_0x207372[_0xb210('0x32')]);if(_0x207372['name']){delete _0x207372[_0xb210('0x33')];}_0x1c203a['status'](_0x3bfac3)[_0xb210('0x34')](_0x207372);};}exports[_0xb210('0x35')]=function(_0x16d6b4,_0x80ba0c){var _0x11222e={},_0x2cd092={},_0x1495a2={'count':0x0,'rows':[]};var _0x59da11=_[_0xb210('0x36')](db[_0xb210('0x37')][_0xb210('0x38')],function(_0x564c33){return{'name':_0x564c33[_0xb210('0x39')],'type':_0x564c33['type'][_0xb210('0x3a')]};});_0x2cd092[_0xb210('0x3b')]=_[_0xb210('0x36')](_0x59da11,'name');_0x2cd092[_0xb210('0x3c')]=_['keys'](_0x16d6b4[_0xb210('0x3c')]);_0x2cd092[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x2cd092[_0xb210('0x3b')],_0x2cd092['query']);_0x11222e[_0xb210('0x3f')]=_[_0xb210('0x3e')](_0x2cd092[_0xb210('0x3b')],qs[_0xb210('0x40')](_0x16d6b4[_0xb210('0x3c')][_0xb210('0x40')]));_0x11222e[_0xb210('0x3f')]=_0x11222e[_0xb210('0x3f')][_0xb210('0x41')]?_0x11222e['attributes']:_0x2cd092[_0xb210('0x3b')];if(!_0x16d6b4[_0xb210('0x3c')][_0xb210('0x42')](_0xb210('0x43'))){_0x11222e[_0xb210('0x2a')]=qs[_0xb210('0x2a')](_0x16d6b4[_0xb210('0x3c')][_0xb210('0x2a')]);_0x11222e[_0xb210('0x44')]=qs[_0xb210('0x44')](_0x16d6b4[_0xb210('0x3c')]['offset']);}_0x11222e[_0xb210('0x45')]=qs[_0xb210('0x46')](_0x16d6b4[_0xb210('0x3c')]['sort']);_0x11222e['where']=qs[_0xb210('0x3d')](_[_0xb210('0x47')](_0x16d6b4['query'],_0x2cd092[_0xb210('0x3d')]));if(_0x16d6b4['query'][_0xb210('0x48')]){_0x11222e['where']=_[_0xb210('0x49')](_0x11222e[_0xb210('0x4a')],{'$or':_[_0xb210('0x36')](_0x59da11,function(_0x3e40cc){if(_0x3e40cc[_0xb210('0x4b')]!==_0xb210('0x4c')){var _0x5f4b51={};_0x5f4b51[_0x3e40cc[_0xb210('0x33')]]={'$like':'%'+_0x16d6b4[_0xb210('0x3c')]['filter']+'%'};return _0x5f4b51;}})});}_0x11222e=_['merge']({},_0x11222e,_0x16d6b4[_0xb210('0x4d')]);var _0x557ee4={'where':_0x11222e[_0xb210('0x4a')]};return db[_0xb210('0x37')][_0xb210('0x4e')](_0x557ee4)[_0xb210('0x1c')](function(_0x5aa616){_0x1495a2[_0xb210('0x4e')]=_0x5aa616;if(_0x16d6b4[_0xb210('0x3c')]['includeAll']){_0x11222e[_0xb210('0x4f')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x11222e);})[_0xb210('0x1c')](function(_0x649174){_0x1495a2[_0xb210('0x50')]=_0x649174;return _0x1495a2;})['then'](respondWithFilteredResult(_0x80ba0c,_0x11222e))[_0xb210('0x26')](handleError(_0x80ba0c,null));};exports['show']=function(_0x431dea,_0x937e96){var _0x494d20={'raw':![],'where':{'id':_0x431dea[_0xb210('0x51')]['id']}},_0x4a2723={};_0x4a2723[_0xb210('0x3b')]=_[_0xb210('0x52')](db[_0xb210('0x37')]['rawAttributes']);_0x4a2723[_0xb210('0x3c')]=_[_0xb210('0x52')](_0x431dea[_0xb210('0x3c')]);_0x4a2723[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x4a2723[_0xb210('0x3b')],_0x4a2723[_0xb210('0x3c')]);_0x494d20[_0xb210('0x3f')]=_['intersection'](_0x4a2723[_0xb210('0x3b')],qs[_0xb210('0x40')](_0x431dea[_0xb210('0x3c')][_0xb210('0x40')]));_0x494d20[_0xb210('0x3f')]=_0x494d20[_0xb210('0x3f')][_0xb210('0x41')]?_0x494d20['attributes']:_0x4a2723[_0xb210('0x3b')];if(_0x431dea[_0xb210('0x3c')][_0xb210('0x53')]){_0x494d20[_0xb210('0x4f')]=[{'all':!![]}];}_0x494d20=_[_0xb210('0x49')]({},_0x494d20,_0x431dea[_0xb210('0x4d')]);return db[_0xb210('0x37')][_0xb210('0x54')](_0x494d20)[_0xb210('0x1c')](handleEntityNotFound(_0x937e96,null))[_0xb210('0x1c')](respondWithResult(_0x937e96,null))[_0xb210('0x26')](handleError(_0x937e96,null));};exports[_0xb210('0x55')]=function(_0x3acd43,_0x380075){return db[_0xb210('0x37')][_0xb210('0x55')](_0x3acd43['body'],{})['then'](respondWithResult(_0x380075,0xc9))[_0xb210('0x26')](handleError(_0x380075,null));};exports[_0xb210('0x30')]=function(_0x69e446,_0x569eba){if(_0x69e446[_0xb210('0x56')]['id']){delete _0x69e446[_0xb210('0x56')]['id'];}return db[_0xb210('0x37')][_0xb210('0x54')]({'where':{'id':_0x69e446['params']['id']}})['then'](handleEntityNotFound(_0x569eba,null))[_0xb210('0x1c')](saveUpdates(_0x69e446['body'],null))[_0xb210('0x1c')](respondWithResult(_0x569eba,null))[_0xb210('0x26')](handleError(_0x569eba,null));};exports[_0xb210('0x31')]=function(_0x337a45,_0x275222){return db['FreshdeskConfiguration'][_0xb210('0x54')]({'where':{'id':_0x337a45[_0xb210('0x51')]['id']}})[_0xb210('0x1c')](handleEntityNotFound(_0x275222,null))[_0xb210('0x1c')](removeEntity(_0x275222,null))['catch'](handleError(_0x275222,null));};exports['getFields']=function(_0x49877a,_0xf84a94,_0x3cbb29){var _0x4758ff={};var _0x136cec={};var _0x32aed6;var _0x511966;return db[_0xb210('0x37')]['findOne']({'where':{'id':_0x49877a[_0xb210('0x51')]['id']}})[_0xb210('0x1c')](handleEntityNotFound(_0xf84a94,null))[_0xb210('0x1c')](function(_0x23a019){if(_0x23a019){_0x32aed6=_0x23a019;_0x136cec[_0xb210('0x3b')]=_['keys'](db[_0xb210('0x57')][_0xb210('0x38')]);_0x136cec[_0xb210('0x3c')]=_[_0xb210('0x52')](_0x49877a[_0xb210('0x3c')]);_0x136cec[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x136cec[_0xb210('0x3b')],_0x136cec[_0xb210('0x3c')]);_0x4758ff[_0xb210('0x3f')]=_[_0xb210('0x3e')](_0x136cec[_0xb210('0x3b')],qs[_0xb210('0x40')](_0x49877a[_0xb210('0x3c')]['fields']));_0x4758ff[_0xb210('0x3f')]=_0x4758ff[_0xb210('0x3f')][_0xb210('0x41')]?_0x4758ff[_0xb210('0x3f')]:_0x136cec[_0xb210('0x3b')];_0x4758ff[_0xb210('0x45')]=qs[_0xb210('0x46')](_0x49877a[_0xb210('0x3c')]['sort']);_0x4758ff[_0xb210('0x4a')]=qs['filters'](_['pick'](_0x49877a[_0xb210('0x3c')],_0x136cec[_0xb210('0x3d')]));if(_0x49877a[_0xb210('0x3c')][_0xb210('0x48')]){_0x4758ff['where']=_['merge'](_0x4758ff[_0xb210('0x4a')],{'$or':_['map'](_0x4758ff[_0xb210('0x3f')],function(_0x19a696){var _0x258e67={};_0x258e67[_0x19a696]={'$like':'%'+_0x49877a['query'][_0xb210('0x48')]+'%'};return _0x258e67;})});}_0x4758ff=_[_0xb210('0x49')]({},_0x4758ff,_0x49877a[_0xb210('0x4d')]);return _0x32aed6[_0xb210('0x58')](_0x4758ff);}})[_0xb210('0x1c')](function(_0x385775){if(_0x385775){_0x511966=_0x385775[_0xb210('0x41')];if(!_0x49877a[_0xb210('0x3c')][_0xb210('0x42')](_0xb210('0x43'))){_0x4758ff[_0xb210('0x2a')]=qs['limit'](_0x49877a[_0xb210('0x3c')]['limit']);_0x4758ff[_0xb210('0x44')]=qs[_0xb210('0x44')](_0x49877a[_0xb210('0x3c')]['offset']);}return _0x32aed6['getFields'](_0x4758ff);}})[_0xb210('0x1c')](function(_0x1fd07e){if(_0x1fd07e){return _0x1fd07e?{'count':_0x511966,'rows':_0x1fd07e}:null;}})[_0xb210('0x1c')](respondWithResult(_0xf84a94,null))[_0xb210('0x26')](handleError(_0xf84a94,null));};exports[_0xb210('0x59')]=function(_0x5cd75f,_0xef8847,_0x3e2d5c){var _0x582178={};var _0x130102={};var _0x27f7d6;var _0x40d8bb;return db[_0xb210('0x37')][_0xb210('0x5a')]({'where':{'id':_0x5cd75f[_0xb210('0x51')]['id']}})['then'](handleEntityNotFound(_0xef8847,null))[_0xb210('0x1c')](function(_0x531572){if(_0x531572){_0x27f7d6=_0x531572;_0x130102[_0xb210('0x3b')]=_['keys'](db[_0xb210('0x57')][_0xb210('0x38')]);_0x130102[_0xb210('0x3c')]=_[_0xb210('0x52')](_0x5cd75f[_0xb210('0x3c')]);_0x130102[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x130102['model'],_0x130102['query']);_0x582178[_0xb210('0x3f')]=_[_0xb210('0x3e')](_0x130102[_0xb210('0x3b')],qs[_0xb210('0x40')](_0x5cd75f[_0xb210('0x3c')][_0xb210('0x40')]));_0x582178[_0xb210('0x3f')]=_0x582178[_0xb210('0x3f')][_0xb210('0x41')]?_0x582178[_0xb210('0x3f')]:_0x130102[_0xb210('0x3b')];_0x582178[_0xb210('0x45')]=qs[_0xb210('0x46')](_0x5cd75f[_0xb210('0x3c')]['sort']);_0x582178['where']=qs[_0xb210('0x3d')](_[_0xb210('0x47')](_0x5cd75f[_0xb210('0x3c')],_0x130102[_0xb210('0x3d')]));if(_0x5cd75f[_0xb210('0x3c')][_0xb210('0x48')]){_0x582178[_0xb210('0x4a')]=_[_0xb210('0x49')](_0x582178[_0xb210('0x4a')],{'$or':_['map'](_0x582178['attributes'],function(_0x2fe3b1){var _0x2731d5={};_0x2731d5[_0x2fe3b1]={'$like':'%'+_0x5cd75f[_0xb210('0x3c')][_0xb210('0x48')]+'%'};return _0x2731d5;})});}_0x582178=_[_0xb210('0x49')]({},_0x582178,_0x5cd75f[_0xb210('0x4d')]);return _0x27f7d6['getSubjects'](_0x582178);}})['then'](function(_0x4817da){if(_0x4817da){_0x40d8bb=_0x4817da[_0xb210('0x41')];if(!_0x5cd75f[_0xb210('0x3c')][_0xb210('0x42')](_0xb210('0x43'))){_0x582178[_0xb210('0x2a')]=qs[_0xb210('0x2a')](_0x5cd75f['query'][_0xb210('0x2a')]);_0x582178[_0xb210('0x44')]=qs[_0xb210('0x44')](_0x5cd75f['query'][_0xb210('0x44')]);}return _0x27f7d6[_0xb210('0x59')](_0x582178);}})[_0xb210('0x1c')](function(_0x12cefb){if(_0x12cefb){return _0x12cefb?{'count':_0x40d8bb,'rows':_0x12cefb}:null;}})[_0xb210('0x1c')](respondWithResult(_0xef8847,null))[_0xb210('0x26')](handleError(_0xef8847,null));};exports['getDescriptions']=function(_0x1e936a,_0x4a8055,_0x1873ee){var _0x376173={};var _0x540158={};var _0x56ac03;var _0x227ea7;return db['FreshdeskConfiguration'][_0xb210('0x5a')]({'where':{'id':_0x1e936a[_0xb210('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a8055,null))[_0xb210('0x1c')](function(_0x313ca0){if(_0x313ca0){_0x56ac03=_0x313ca0;_0x540158[_0xb210('0x3b')]=_[_0xb210('0x52')](db[_0xb210('0x57')]['rawAttributes']);_0x540158['query']=_['keys'](_0x1e936a[_0xb210('0x3c')]);_0x540158[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x540158[_0xb210('0x3b')],_0x540158[_0xb210('0x3c')]);_0x376173[_0xb210('0x3f')]=_[_0xb210('0x3e')](_0x540158[_0xb210('0x3b')],qs[_0xb210('0x40')](_0x1e936a[_0xb210('0x3c')][_0xb210('0x40')]));_0x376173[_0xb210('0x3f')]=_0x376173[_0xb210('0x3f')][_0xb210('0x41')]?_0x376173[_0xb210('0x3f')]:_0x540158['model'];_0x376173[_0xb210('0x45')]=qs[_0xb210('0x46')](_0x1e936a[_0xb210('0x3c')][_0xb210('0x46')]);_0x376173[_0xb210('0x4a')]=qs[_0xb210('0x3d')](_[_0xb210('0x47')](_0x1e936a['query'],_0x540158['filters']));if(_0x1e936a[_0xb210('0x3c')][_0xb210('0x48')]){_0x376173[_0xb210('0x4a')]=_[_0xb210('0x49')](_0x376173[_0xb210('0x4a')],{'$or':_[_0xb210('0x36')](_0x376173['attributes'],function(_0x3521b5){var _0x4cbcb2={};_0x4cbcb2[_0x3521b5]={'$like':'%'+_0x1e936a['query'][_0xb210('0x48')]+'%'};return _0x4cbcb2;})});}_0x376173=_[_0xb210('0x49')]({},_0x376173,_0x1e936a[_0xb210('0x4d')]);return _0x56ac03[_0xb210('0x5b')](_0x376173);}})[_0xb210('0x1c')](function(_0x2db6b3){if(_0x2db6b3){_0x227ea7=_0x2db6b3['length'];if(!_0x1e936a[_0xb210('0x3c')]['hasOwnProperty'](_0xb210('0x43'))){_0x376173[_0xb210('0x2a')]=qs[_0xb210('0x2a')](_0x1e936a[_0xb210('0x3c')]['limit']);_0x376173['offset']=qs[_0xb210('0x44')](_0x1e936a[_0xb210('0x3c')][_0xb210('0x44')]);}return _0x56ac03['getDescriptions'](_0x376173);}})[_0xb210('0x1c')](function(_0x1d86fa){if(_0x1d86fa){return _0x1d86fa?{'count':_0x227ea7,'rows':_0x1d86fa}:null;}})['then'](respondWithResult(_0x4a8055,null))[_0xb210('0x26')](handleError(_0x4a8055,null));};exports['getTags']=function(_0xe525e6,_0x3cf841,_0x5915d5){var _0x122046={};var _0x1dbe3d={};var _0x1a8f5e;var _0x527685;return db[_0xb210('0x37')][_0xb210('0x5a')]({'where':{'id':_0xe525e6[_0xb210('0x51')]['id']}})[_0xb210('0x1c')](handleEntityNotFound(_0x3cf841,null))[_0xb210('0x1c')](function(_0x1495ef){if(_0x1495ef){_0x1a8f5e=_0x1495ef;_0x1dbe3d[_0xb210('0x3b')]=_['keys'](db['Tag'][_0xb210('0x38')]);_0x1dbe3d['query']=_[_0xb210('0x52')](_0xe525e6[_0xb210('0x3c')]);_0x1dbe3d[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x1dbe3d[_0xb210('0x3b')],_0x1dbe3d[_0xb210('0x3c')]);_0x122046[_0xb210('0x3f')]=_['intersection'](_0x1dbe3d[_0xb210('0x3b')],qs['fields'](_0xe525e6[_0xb210('0x3c')]['fields']));_0x122046[_0xb210('0x3f')]=_0x122046['attributes'][_0xb210('0x41')]?_0x122046[_0xb210('0x3f')]:_0x1dbe3d[_0xb210('0x3b')];_0x122046[_0xb210('0x45')]=qs['sort'](_0xe525e6[_0xb210('0x3c')]['sort']);_0x122046[_0xb210('0x4a')]=qs[_0xb210('0x3d')](_['pick'](_0xe525e6['query'],_0x1dbe3d[_0xb210('0x3d')]));if(_0xe525e6[_0xb210('0x3c')][_0xb210('0x48')]){_0x122046[_0xb210('0x4a')]=_['merge'](_0x122046[_0xb210('0x4a')],{'$or':_[_0xb210('0x36')](_0x122046[_0xb210('0x3f')],function(_0x486c6e){var _0x1ac710={};_0x1ac710[_0x486c6e]={'$like':'%'+_0xe525e6[_0xb210('0x3c')]['filter']+'%'};return _0x1ac710;})});}_0x122046=_[_0xb210('0x49')]({},_0x122046,_0xe525e6[_0xb210('0x4d')]);return _0x1a8f5e[_0xb210('0x5c')](_0x122046);}})[_0xb210('0x1c')](function(_0x181963){if(_0x181963){_0x527685=_0x181963[_0xb210('0x41')];if(!_0xe525e6[_0xb210('0x3c')][_0xb210('0x42')](_0xb210('0x43'))){_0x122046[_0xb210('0x2a')]=qs[_0xb210('0x2a')](_0xe525e6[_0xb210('0x3c')]['limit']);_0x122046[_0xb210('0x44')]=qs[_0xb210('0x44')](_0xe525e6[_0xb210('0x3c')][_0xb210('0x44')]);}return _0x1a8f5e[_0xb210('0x5c')](_0x122046);}})[_0xb210('0x1c')](function(_0x5b9c8b){if(_0x5b9c8b){return _0x5b9c8b?{'count':_0x527685,'rows':_0x5b9c8b}:null;}})[_0xb210('0x1c')](respondWithResult(_0x3cf841,null))[_0xb210('0x26')](handleError(_0x3cf841,null));};exports[_0xb210('0x5d')]=function(_0x43bc49,_0xaece97,_0x171d2e){if(_0x43bc49['body']['id']){delete _0x43bc49[_0xb210('0x56')]['id'];}return db['FreshdeskConfiguration'][_0xb210('0x5a')]({'where':{'id':_0x43bc49[_0xb210('0x51')]['id']}})[_0xb210('0x1c')](handleEntityNotFound(_0xaece97,null))['then'](function(_0x22ae8f){if(_0x22ae8f){return _0x22ae8f['setTags'](_0x43bc49['body'][_0xb210('0x5e')]||[]);}return null;})[_0xb210('0x1c')](respondWithResult(_0xaece97,null))['catch'](handleError(_0xaece97,null));};
\ No newline at end of file
+var _0xf731=['hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','where','count','includeAll','include','findAll','show','params','options','create','body','find','findOne','FreshdeskField','getFields','getDescriptions','map','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','end','name','send','index','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x1cfaa1,_0x437686){var _0x451e02=function(_0x7de656){while(--_0x7de656){_0x1cfaa1['push'](_0x1cfaa1['shift']());}};_0x451e02(++_0x437686);}(_0xf731,0xde));var _0x1f73=function(_0x59a539,_0x484818){_0x59a539=_0x59a539-0x0;var _0x5b9187=_0xf731[_0x59a539];return _0x5b9187;};'use strict';var pdf=require(_0x1f73('0x0'));var emlformat=require(_0x1f73('0x1'));var rimraf=require(_0x1f73('0x2'));var zipdir=require(_0x1f73('0x3'));var jsonpatch=require(_0x1f73('0x4'));var rp=require(_0x1f73('0x5'));var moment=require(_0x1f73('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1f73('0x7'));var path=require(_0x1f73('0x8'));var sox=require(_0x1f73('0x9'));var csv=require(_0x1f73('0xa'));var ejs=require(_0x1f73('0xb'));var fs=require('fs');var _=require(_0x1f73('0xc'));var squel=require(_0x1f73('0xd'));var crypto=require(_0x1f73('0xe'));var jsforce=require(_0x1f73('0xf'));var deskjs=require(_0x1f73('0x10'));var toCsv=require(_0x1f73('0xa'));var querystring=require(_0x1f73('0x11'));var Papa=require('papaparse');var Redis=require(_0x1f73('0x12'));var authService=require(_0x1f73('0x13'));var qs=require(_0x1f73('0x14'));var as=require(_0x1f73('0x15'));var hardwareService=require(_0x1f73('0x16'));var logger=require(_0x1f73('0x17'))('api');var utils=require(_0x1f73('0x18'));var config=require(_0x1f73('0x19'));var licenseUtil=require(_0x1f73('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x1f73('0x1b')][_0x1f73('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x56b51b,_0x4f5021,_0x4f67dc,_0x3f372b){return new BPromise(function(_0x4f8b2d,_0x29b089){var _0x3b4845=_0x3f372b||client;return _0x3b4845[_0x1f73('0x1d')](_0x56b51b,_0x4f67dc)[_0x1f73('0x1e')](function(_0x1edc7d){logger[_0x1f73('0x1f')](_0x1f73('0x20'),_0x4f5021,_0x1f73('0x21'));logger[_0x1f73('0x22')](_0x1f73('0x23'),_0x4f5021,_0x1f73('0x21'),JSON[_0x1f73('0x24')](_0x1edc7d));if(_0x1edc7d[_0x1f73('0x25')]){if(_0x1edc7d[_0x1f73('0x25')][_0x1f73('0x26')]===0x1f4){logger['error'](_0x1f73('0x20'),_0x4f5021,_0x1edc7d['error'][_0x1f73('0x27')]);return _0x29b089(_0x1edc7d[_0x1f73('0x25')][_0x1f73('0x27')]);}logger[_0x1f73('0x25')](_0x1f73('0x20'),_0x4f5021,_0x1edc7d[_0x1f73('0x25')][_0x1f73('0x27')]);return _0x4f8b2d(_0x1edc7d['error'][_0x1f73('0x27')]);}else{logger[_0x1f73('0x1f')](_0x1f73('0x20'),_0x4f5021,_0x1f73('0x21'));_0x4f8b2d(_0x1edc7d[_0x1f73('0x28')][_0x1f73('0x27')]);}})[_0x1f73('0x29')](function(_0x3d58fd){logger['error'](_0x1f73('0x20'),_0x4f5021,_0x3d58fd);_0x29b089(_0x3d58fd);});});}function respondWithStatusCode(_0x22fe30,_0x488b39){_0x488b39=_0x488b39||0xcc;return function(_0x45bbec){if(_0x45bbec){return _0x22fe30[_0x1f73('0x2a')](_0x488b39);}return _0x22fe30['status'](_0x488b39)['end']();};}function respondWithResult(_0x9edb2e,_0x32338d){_0x32338d=_0x32338d||0xc8;return function(_0x5abc06){if(_0x5abc06){return _0x9edb2e[_0x1f73('0x2b')](_0x32338d)[_0x1f73('0x2c')](_0x5abc06);}};}function respondWithFilteredResult(_0x2218ee,_0x5c94bf){return function(_0x4bf1ee){if(_0x4bf1ee){var _0x2e0905=_0x4bf1ee['count'],_0x1fa579=_0x5c94bf['offset'],_0x5a3c8b=_0x5c94bf[_0x1f73('0x2d')]+_0x5c94bf[_0x1f73('0x2e')],_0x4e1367;if(_0x5a3c8b>=_0x2e0905){_0x5a3c8b=_0x2e0905;_0x4e1367=0xc8;}else{_0x4e1367=0xce;}_0x2218ee[_0x1f73('0x2b')](_0x4e1367);return _0x2218ee[_0x1f73('0x2f')](_0x1f73('0x30'),_0x1fa579+'-'+_0x5a3c8b+'/'+_0x2e0905)[_0x1f73('0x2c')](_0x4bf1ee);}return null;};}function patchUpdates(_0x953dbb){return function(_0x46a6b6){try{jsonpatch['apply'](_0x46a6b6,_0x953dbb,!![]);}catch(_0x52a5fa){return BPromise[_0x1f73('0x31')](_0x52a5fa);}return _0x46a6b6[_0x1f73('0x32')]();};}function saveUpdates(_0x4adbd4,_0x10d93b){return function(_0x2d1f65){if(_0x2d1f65){return _0x2d1f65[_0x1f73('0x33')](_0x4adbd4)[_0x1f73('0x1e')](function(_0xb90308){return _0xb90308;});}return null;};}function removeEntity(_0x581542,_0x595231){return function(_0x3c94bb){if(_0x3c94bb){return _0x3c94bb[_0x1f73('0x34')]()[_0x1f73('0x1e')](function(){_0x581542[_0x1f73('0x2b')](0xcc)[_0x1f73('0x35')]();});}};}function handleEntityNotFound(_0x179ca2,_0x1f376e){return function(_0xe717d){if(!_0xe717d){_0x179ca2[_0x1f73('0x2a')](0x194);}return _0xe717d;};}function handleError(_0x1cfc29,_0x2b3073){_0x2b3073=_0x2b3073||0x1f4;return function(_0x52daa0){logger['error'](_0x52daa0['stack']);if(_0x52daa0[_0x1f73('0x36')]){delete _0x52daa0['name'];}_0x1cfc29[_0x1f73('0x2b')](_0x2b3073)[_0x1f73('0x37')](_0x52daa0);};}exports[_0x1f73('0x38')]=function(_0x52f564,_0x1c751f){var _0x42cb70={},_0x2f61d3={},_0x792525={'count':0x0,'rows':[]};var _0x3b072e=_['map'](db[_0x1f73('0x39')][_0x1f73('0x3a')],function(_0x18e732){return{'name':_0x18e732['fieldName'],'type':_0x18e732[_0x1f73('0x3b')][_0x1f73('0x3c')]};});_0x2f61d3[_0x1f73('0x3d')]=_['map'](_0x3b072e,'name');_0x2f61d3[_0x1f73('0x3e')]=_[_0x1f73('0x3f')](_0x52f564[_0x1f73('0x3e')]);_0x2f61d3[_0x1f73('0x40')]=_[_0x1f73('0x41')](_0x2f61d3['model'],_0x2f61d3['query']);_0x42cb70['attributes']=_[_0x1f73('0x41')](_0x2f61d3[_0x1f73('0x3d')],qs[_0x1f73('0x42')](_0x52f564[_0x1f73('0x3e')][_0x1f73('0x42')]));_0x42cb70[_0x1f73('0x43')]=_0x42cb70[_0x1f73('0x43')][_0x1f73('0x44')]?_0x42cb70['attributes']:_0x2f61d3[_0x1f73('0x3d')];if(!_0x52f564[_0x1f73('0x3e')][_0x1f73('0x45')](_0x1f73('0x46'))){_0x42cb70['limit']=qs[_0x1f73('0x2e')](_0x52f564[_0x1f73('0x3e')][_0x1f73('0x2e')]);_0x42cb70[_0x1f73('0x2d')]=qs['offset'](_0x52f564[_0x1f73('0x3e')][_0x1f73('0x2d')]);}_0x42cb70[_0x1f73('0x47')]=qs[_0x1f73('0x48')](_0x52f564['query'][_0x1f73('0x48')]);_0x42cb70['where']=qs[_0x1f73('0x40')](_[_0x1f73('0x49')](_0x52f564[_0x1f73('0x3e')],_0x2f61d3['filters']),_0x3b072e);if(_0x52f564[_0x1f73('0x3e')]['filter']){_0x42cb70['where']=_[_0x1f73('0x4a')](_0x42cb70['where'],{'$or':_['map'](_0x3b072e,function(_0x1f7794){if(_0x1f7794['type']!==_0x1f73('0x4b')){var _0x152adf={};_0x152adf[_0x1f7794[_0x1f73('0x36')]]={'$like':'%'+_0x52f564[_0x1f73('0x3e')][_0x1f73('0x4c')]+'%'};return _0x152adf;}})});}_0x42cb70=_[_0x1f73('0x4a')]({},_0x42cb70,_0x52f564['options']);var _0x254fd4={'where':_0x42cb70[_0x1f73('0x4d')]};return db[_0x1f73('0x39')][_0x1f73('0x4e')](_0x254fd4)['then'](function(_0x17587c){_0x792525[_0x1f73('0x4e')]=_0x17587c;if(_0x52f564[_0x1f73('0x3e')][_0x1f73('0x4f')]){_0x42cb70[_0x1f73('0x50')]=[{'all':!![]}];}return db[_0x1f73('0x39')][_0x1f73('0x51')](_0x42cb70);})['then'](function(_0x2f7b7d){_0x792525['rows']=_0x2f7b7d;return _0x792525;})[_0x1f73('0x1e')](respondWithFilteredResult(_0x1c751f,_0x42cb70))[_0x1f73('0x29')](handleError(_0x1c751f,null));};exports[_0x1f73('0x52')]=function(_0x57e3d4,_0x4f4bde){var _0x454ec8={'raw':![],'where':{'id':_0x57e3d4[_0x1f73('0x53')]['id']}},_0x300497={};_0x300497[_0x1f73('0x3d')]=_['keys'](db['FreshdeskConfiguration'][_0x1f73('0x3a')]);_0x300497['query']=_[_0x1f73('0x3f')](_0x57e3d4[_0x1f73('0x3e')]);_0x300497[_0x1f73('0x40')]=_[_0x1f73('0x41')](_0x300497[_0x1f73('0x3d')],_0x300497[_0x1f73('0x3e')]);_0x454ec8[_0x1f73('0x43')]=_[_0x1f73('0x41')](_0x300497[_0x1f73('0x3d')],qs['fields'](_0x57e3d4[_0x1f73('0x3e')][_0x1f73('0x42')]));_0x454ec8[_0x1f73('0x43')]=_0x454ec8['attributes'][_0x1f73('0x44')]?_0x454ec8[_0x1f73('0x43')]:_0x300497['model'];if(_0x57e3d4[_0x1f73('0x3e')][_0x1f73('0x4f')]){_0x454ec8['include']=[{'all':!![]}];}_0x454ec8=_[_0x1f73('0x4a')]({},_0x454ec8,_0x57e3d4[_0x1f73('0x54')]);return db[_0x1f73('0x39')]['find'](_0x454ec8)[_0x1f73('0x1e')](handleEntityNotFound(_0x4f4bde,null))[_0x1f73('0x1e')](respondWithResult(_0x4f4bde,null))[_0x1f73('0x29')](handleError(_0x4f4bde,null));};exports['create']=function(_0x2bcc1b,_0x5aaf47){return db[_0x1f73('0x39')][_0x1f73('0x55')](_0x2bcc1b[_0x1f73('0x56')],{})[_0x1f73('0x1e')](respondWithResult(_0x5aaf47,0xc9))[_0x1f73('0x29')](handleError(_0x5aaf47,null));};exports[_0x1f73('0x33')]=function(_0x249607,_0x240a7a){if(_0x249607[_0x1f73('0x56')]['id']){delete _0x249607[_0x1f73('0x56')]['id'];}return db[_0x1f73('0x39')][_0x1f73('0x57')]({'where':{'id':_0x249607['params']['id']}})[_0x1f73('0x1e')](handleEntityNotFound(_0x240a7a,null))[_0x1f73('0x1e')](saveUpdates(_0x249607[_0x1f73('0x56')],null))[_0x1f73('0x1e')](respondWithResult(_0x240a7a,null))[_0x1f73('0x29')](handleError(_0x240a7a,null));};exports['destroy']=function(_0x2103b0,_0x4417d9){return db['FreshdeskConfiguration'][_0x1f73('0x57')]({'where':{'id':_0x2103b0[_0x1f73('0x53')]['id']}})[_0x1f73('0x1e')](handleEntityNotFound(_0x4417d9,null))[_0x1f73('0x1e')](removeEntity(_0x4417d9,null))[_0x1f73('0x29')](handleError(_0x4417d9,null));};exports['getFields']=function(_0x5761b7,_0x15ece1,_0x531176){var _0x1c4ca6={};var _0x399a55={};var _0xa86f65;var _0x160dbc;return db['FreshdeskConfiguration'][_0x1f73('0x58')]({'where':{'id':_0x5761b7[_0x1f73('0x53')]['id']}})[_0x1f73('0x1e')](handleEntityNotFound(_0x15ece1,null))[_0x1f73('0x1e')](function(_0x473a3f){if(_0x473a3f){_0xa86f65=_0x473a3f;_0x399a55[_0x1f73('0x3d')]=_[_0x1f73('0x3f')](db[_0x1f73('0x59')]['rawAttributes']);_0x399a55[_0x1f73('0x3e')]=_['keys'](_0x5761b7[_0x1f73('0x3e')]);_0x399a55[_0x1f73('0x40')]=_[_0x1f73('0x41')](_0x399a55[_0x1f73('0x3d')],_0x399a55[_0x1f73('0x3e')]);_0x1c4ca6[_0x1f73('0x43')]=_[_0x1f73('0x41')](_0x399a55[_0x1f73('0x3d')],qs[_0x1f73('0x42')](_0x5761b7[_0x1f73('0x3e')][_0x1f73('0x42')]));_0x1c4ca6['attributes']=_0x1c4ca6[_0x1f73('0x43')][_0x1f73('0x44')]?_0x1c4ca6[_0x1f73('0x43')]:_0x399a55[_0x1f73('0x3d')];_0x1c4ca6[_0x1f73('0x47')]=qs[_0x1f73('0x48')](_0x5761b7[_0x1f73('0x3e')][_0x1f73('0x48')]);_0x1c4ca6[_0x1f73('0x4d')]=qs[_0x1f73('0x40')](_[_0x1f73('0x49')](_0x5761b7[_0x1f73('0x3e')],_0x399a55[_0x1f73('0x40')]));if(_0x5761b7[_0x1f73('0x3e')][_0x1f73('0x4c')]){_0x1c4ca6[_0x1f73('0x4d')]=_[_0x1f73('0x4a')](_0x1c4ca6[_0x1f73('0x4d')],{'$or':_['map'](_0x1c4ca6[_0x1f73('0x43')],function(_0x5c5610){var _0x56385f={};_0x56385f[_0x5c5610]={'$like':'%'+_0x5761b7[_0x1f73('0x3e')]['filter']+'%'};return _0x56385f;})});}_0x1c4ca6=_[_0x1f73('0x4a')]({},_0x1c4ca6,_0x5761b7[_0x1f73('0x54')]);return _0xa86f65[_0x1f73('0x5a')](_0x1c4ca6);}})[_0x1f73('0x1e')](function(_0x20a96e){if(_0x20a96e){_0x160dbc=_0x20a96e[_0x1f73('0x44')];if(!_0x5761b7[_0x1f73('0x3e')]['hasOwnProperty'](_0x1f73('0x46'))){_0x1c4ca6['limit']=qs[_0x1f73('0x2e')](_0x5761b7[_0x1f73('0x3e')][_0x1f73('0x2e')]);_0x1c4ca6[_0x1f73('0x2d')]=qs[_0x1f73('0x2d')](_0x5761b7[_0x1f73('0x3e')]['offset']);}return _0xa86f65[_0x1f73('0x5a')](_0x1c4ca6);}})[_0x1f73('0x1e')](function(_0x5a873d){if(_0x5a873d){return _0x5a873d?{'count':_0x160dbc,'rows':_0x5a873d}:null;}})[_0x1f73('0x1e')](respondWithResult(_0x15ece1,null))[_0x1f73('0x29')](handleError(_0x15ece1,null));};exports['getSubjects']=function(_0x28a275,_0x591e8a,_0x4621e5){var _0x1d9f96={};var _0x5f50c0={};var _0x5558b;var _0xc1c977;return db[_0x1f73('0x39')][_0x1f73('0x58')]({'where':{'id':_0x28a275[_0x1f73('0x53')]['id']}})[_0x1f73('0x1e')](handleEntityNotFound(_0x591e8a,null))[_0x1f73('0x1e')](function(_0xd9abcb){if(_0xd9abcb){_0x5558b=_0xd9abcb;_0x5f50c0['model']=_[_0x1f73('0x3f')](db[_0x1f73('0x59')][_0x1f73('0x3a')]);_0x5f50c0[_0x1f73('0x3e')]=_['keys'](_0x28a275['query']);_0x5f50c0[_0x1f73('0x40')]=_['intersection'](_0x5f50c0[_0x1f73('0x3d')],_0x5f50c0[_0x1f73('0x3e')]);_0x1d9f96[_0x1f73('0x43')]=_['intersection'](_0x5f50c0[_0x1f73('0x3d')],qs['fields'](_0x28a275[_0x1f73('0x3e')][_0x1f73('0x42')]));_0x1d9f96[_0x1f73('0x43')]=_0x1d9f96[_0x1f73('0x43')][_0x1f73('0x44')]?_0x1d9f96[_0x1f73('0x43')]:_0x5f50c0['model'];_0x1d9f96[_0x1f73('0x47')]=qs[_0x1f73('0x48')](_0x28a275['query'][_0x1f73('0x48')]);_0x1d9f96['where']=qs['filters'](_['pick'](_0x28a275[_0x1f73('0x3e')],_0x5f50c0[_0x1f73('0x40')]));if(_0x28a275[_0x1f73('0x3e')][_0x1f73('0x4c')]){_0x1d9f96[_0x1f73('0x4d')]=_['merge'](_0x1d9f96[_0x1f73('0x4d')],{'$or':_['map'](_0x1d9f96['attributes'],function(_0x1a9f05){var _0x42a3b2={};_0x42a3b2[_0x1a9f05]={'$like':'%'+_0x28a275[_0x1f73('0x3e')]['filter']+'%'};return _0x42a3b2;})});}_0x1d9f96=_['merge']({},_0x1d9f96,_0x28a275[_0x1f73('0x54')]);return _0x5558b['getSubjects'](_0x1d9f96);}})['then'](function(_0x466daf){if(_0x466daf){_0xc1c977=_0x466daf[_0x1f73('0x44')];if(!_0x28a275[_0x1f73('0x3e')][_0x1f73('0x45')](_0x1f73('0x46'))){_0x1d9f96[_0x1f73('0x2e')]=qs[_0x1f73('0x2e')](_0x28a275[_0x1f73('0x3e')]['limit']);_0x1d9f96[_0x1f73('0x2d')]=qs[_0x1f73('0x2d')](_0x28a275[_0x1f73('0x3e')][_0x1f73('0x2d')]);}return _0x5558b['getSubjects'](_0x1d9f96);}})[_0x1f73('0x1e')](function(_0x1d1ae9){if(_0x1d1ae9){return _0x1d1ae9?{'count':_0xc1c977,'rows':_0x1d1ae9}:null;}})[_0x1f73('0x1e')](respondWithResult(_0x591e8a,null))[_0x1f73('0x29')](handleError(_0x591e8a,null));};exports[_0x1f73('0x5b')]=function(_0x3fd91a,_0x8407d6,_0x40c5c7){var _0xed1822={};var _0xcc9235={};var _0x576823;var _0x24c535;return db['FreshdeskConfiguration'][_0x1f73('0x58')]({'where':{'id':_0x3fd91a[_0x1f73('0x53')]['id']}})[_0x1f73('0x1e')](handleEntityNotFound(_0x8407d6,null))['then'](function(_0x5afa4c){if(_0x5afa4c){_0x576823=_0x5afa4c;_0xcc9235[_0x1f73('0x3d')]=_['keys'](db['FreshdeskField'][_0x1f73('0x3a')]);_0xcc9235[_0x1f73('0x3e')]=_[_0x1f73('0x3f')](_0x3fd91a[_0x1f73('0x3e')]);_0xcc9235[_0x1f73('0x40')]=_[_0x1f73('0x41')](_0xcc9235[_0x1f73('0x3d')],_0xcc9235[_0x1f73('0x3e')]);_0xed1822[_0x1f73('0x43')]=_[_0x1f73('0x41')](_0xcc9235[_0x1f73('0x3d')],qs['fields'](_0x3fd91a[_0x1f73('0x3e')][_0x1f73('0x42')]));_0xed1822['attributes']=_0xed1822[_0x1f73('0x43')][_0x1f73('0x44')]?_0xed1822[_0x1f73('0x43')]:_0xcc9235[_0x1f73('0x3d')];_0xed1822[_0x1f73('0x47')]=qs[_0x1f73('0x48')](_0x3fd91a[_0x1f73('0x3e')][_0x1f73('0x48')]);_0xed1822['where']=qs['filters'](_['pick'](_0x3fd91a['query'],_0xcc9235['filters']));if(_0x3fd91a['query'][_0x1f73('0x4c')]){_0xed1822[_0x1f73('0x4d')]=_[_0x1f73('0x4a')](_0xed1822[_0x1f73('0x4d')],{'$or':_[_0x1f73('0x5c')](_0xed1822[_0x1f73('0x43')],function(_0x1edd08){var _0x21067e={};_0x21067e[_0x1edd08]={'$like':'%'+_0x3fd91a['query'][_0x1f73('0x4c')]+'%'};return _0x21067e;})});}_0xed1822=_['merge']({},_0xed1822,_0x3fd91a[_0x1f73('0x54')]);return _0x576823['getDescriptions'](_0xed1822);}})[_0x1f73('0x1e')](function(_0x524196){if(_0x524196){_0x24c535=_0x524196['length'];if(!_0x3fd91a['query'][_0x1f73('0x45')]('nolimit')){_0xed1822[_0x1f73('0x2e')]=qs[_0x1f73('0x2e')](_0x3fd91a[_0x1f73('0x3e')][_0x1f73('0x2e')]);_0xed1822[_0x1f73('0x2d')]=qs[_0x1f73('0x2d')](_0x3fd91a['query'][_0x1f73('0x2d')]);}return _0x576823[_0x1f73('0x5b')](_0xed1822);}})['then'](function(_0x585202){if(_0x585202){return _0x585202?{'count':_0x24c535,'rows':_0x585202}:null;}})['then'](respondWithResult(_0x8407d6,null))[_0x1f73('0x29')](handleError(_0x8407d6,null));};exports['getTags']=function(_0x4660f2,_0x1abf51,_0x3ddf11){var _0x576da1={};var _0x11b1b7={};var _0xb2d744;var _0x5e2ed3;return db[_0x1f73('0x39')][_0x1f73('0x58')]({'where':{'id':_0x4660f2[_0x1f73('0x53')]['id']}})[_0x1f73('0x1e')](handleEntityNotFound(_0x1abf51,null))[_0x1f73('0x1e')](function(_0x53ad9f){if(_0x53ad9f){_0xb2d744=_0x53ad9f;_0x11b1b7[_0x1f73('0x3d')]=_[_0x1f73('0x3f')](db[_0x1f73('0x5d')]['rawAttributes']);_0x11b1b7[_0x1f73('0x3e')]=_[_0x1f73('0x3f')](_0x4660f2['query']);_0x11b1b7[_0x1f73('0x40')]=_['intersection'](_0x11b1b7['model'],_0x11b1b7[_0x1f73('0x3e')]);_0x576da1['attributes']=_[_0x1f73('0x41')](_0x11b1b7[_0x1f73('0x3d')],qs[_0x1f73('0x42')](_0x4660f2[_0x1f73('0x3e')][_0x1f73('0x42')]));_0x576da1[_0x1f73('0x43')]=_0x576da1['attributes'][_0x1f73('0x44')]?_0x576da1['attributes']:_0x11b1b7[_0x1f73('0x3d')];_0x576da1[_0x1f73('0x47')]=qs[_0x1f73('0x48')](_0x4660f2[_0x1f73('0x3e')][_0x1f73('0x48')]);_0x576da1['where']=qs[_0x1f73('0x40')](_[_0x1f73('0x49')](_0x4660f2[_0x1f73('0x3e')],_0x11b1b7[_0x1f73('0x40')]));if(_0x4660f2[_0x1f73('0x3e')]['filter']){_0x576da1[_0x1f73('0x4d')]=_['merge'](_0x576da1[_0x1f73('0x4d')],{'$or':_[_0x1f73('0x5c')](_0x576da1[_0x1f73('0x43')],function(_0x547718){var _0x10292e={};_0x10292e[_0x547718]={'$like':'%'+_0x4660f2[_0x1f73('0x3e')]['filter']+'%'};return _0x10292e;})});}_0x576da1=_[_0x1f73('0x4a')]({},_0x576da1,_0x4660f2['options']);return _0xb2d744[_0x1f73('0x5e')](_0x576da1);}})['then'](function(_0x1c4cc1){if(_0x1c4cc1){_0x5e2ed3=_0x1c4cc1['length'];if(!_0x4660f2[_0x1f73('0x3e')]['hasOwnProperty'](_0x1f73('0x46'))){_0x576da1[_0x1f73('0x2e')]=qs['limit'](_0x4660f2[_0x1f73('0x3e')]['limit']);_0x576da1[_0x1f73('0x2d')]=qs['offset'](_0x4660f2[_0x1f73('0x3e')][_0x1f73('0x2d')]);}return _0xb2d744[_0x1f73('0x5e')](_0x576da1);}})[_0x1f73('0x1e')](function(_0x9b4379){if(_0x9b4379){return _0x9b4379?{'count':_0x5e2ed3,'rows':_0x9b4379}:null;}})[_0x1f73('0x1e')](respondWithResult(_0x1abf51,null))[_0x1f73('0x29')](handleError(_0x1abf51,null));};exports[_0x1f73('0x5f')]=function(_0x2d17a3,_0x53f9f0,_0xf66e39){if(_0x2d17a3[_0x1f73('0x56')]['id']){delete _0x2d17a3['body']['id'];}return db[_0x1f73('0x39')][_0x1f73('0x58')]({'where':{'id':_0x2d17a3[_0x1f73('0x53')]['id']}})['then'](handleEntityNotFound(_0x53f9f0,null))[_0x1f73('0x1e')](function(_0x251de0){if(_0x251de0){return _0x251de0[_0x1f73('0x5f')](_0x2d17a3[_0x1f73('0x56')][_0x1f73('0x60')]||[]);}return null;})[_0x1f73('0x1e')](respondWithResult(_0x53f9f0,null))[_0x1f73('0x29')](handleError(_0x53f9f0,null));};
\ No newline at end of file