Built motion from commit 9d0783e6.|2.6.13
[motion2.git] / server / api / intZohoConfiguration / intZohoConfiguration.controller.js
index da6c27e..23b1cdf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x02f5=['save','then','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','intersection','find','create','body','update','getFields','findOne','ZohoField','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject'];(function(_0x4f06d3,_0x445507){var _0x322e62=function(_0x59a7c6){while(--_0x59a7c6){_0x4f06d3['push'](_0x4f06d3['shift']());}};_0x322e62(++_0x445507);}(_0x02f5,0xc7));var _0x502f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x02f5[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require(_0x502f('0x0'));var rimraf=require(_0x502f('0x1'));var zipdir=require(_0x502f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x502f('0x3'));var moment=require(_0x502f('0x4'));var BPromise=require(_0x502f('0x5'));var Mustache=require(_0x502f('0x6'));var util=require(_0x502f('0x7'));var path=require(_0x502f('0x8'));var sox=require(_0x502f('0x9'));var csv=require(_0x502f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x502f('0xb'));var _=require(_0x502f('0xc'));var squel=require(_0x502f('0xd'));var crypto=require(_0x502f('0xe'));var jsforce=require(_0x502f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x502f('0xa'));var querystring=require(_0x502f('0x10'));var Papa=require(_0x502f('0x11'));var Redis=require(_0x502f('0x12'));var authService=require(_0x502f('0x13'));var qs=require(_0x502f('0x14'));var as=require(_0x502f('0x15'));var hardwareService=require(_0x502f('0x16'));var logger=require('../../config/logger')(_0x502f('0x17'));var utils=require('../../config/utils');var config=require(_0x502f('0x18'));var licenseUtil=require(_0x502f('0x19'));var db=require(_0x502f('0x1a'))['db'];function respondWithStatusCode(_0x294fb2,_0x130837){_0x130837=_0x130837||0xcc;return function(_0x163256){if(_0x163256){return _0x294fb2[_0x502f('0x1b')](_0x130837);}return _0x294fb2[_0x502f('0x1c')](_0x130837)['end']();};}function respondWithResult(_0x55a89b,_0x2b12be){_0x2b12be=_0x2b12be||0xc8;return function(_0x2bdc0f){if(_0x2bdc0f){return _0x55a89b[_0x502f('0x1c')](_0x2b12be)['json'](_0x2bdc0f);}};}function respondWithFilteredResult(_0x562219,_0x4b7f69){return function(_0x42d39c){if(_0x42d39c){var _0x5de7e4=typeof _0x4b7f69[_0x502f('0x1d')]===_0x502f('0x1e')&&typeof _0x4b7f69[_0x502f('0x1f')]==='undefined';var _0x47826e=_0x42d39c[_0x502f('0x20')];var _0x5c75ca=_0x5de7e4?0x0:_0x4b7f69[_0x502f('0x1d')];var _0x5f5934=_0x5de7e4?_0x42d39c[_0x502f('0x20')]:_0x4b7f69['offset']+_0x4b7f69[_0x502f('0x1f')];var _0x7c62d3;if(_0x5f5934>=_0x47826e){_0x5f5934=_0x47826e;_0x7c62d3=0xc8;}else{_0x7c62d3=0xce;}_0x562219[_0x502f('0x1c')](_0x7c62d3);return _0x562219[_0x502f('0x21')]('Content-Range',_0x5c75ca+'-'+_0x5f5934+'/'+_0x47826e)['json'](_0x42d39c);}return null;};}function patchUpdates(_0x5137b7){return function(_0xbc5cab){try{jsonpatch['apply'](_0xbc5cab,_0x5137b7,!![]);}catch(_0x334985){return BPromise[_0x502f('0x22')](_0x334985);}return _0xbc5cab[_0x502f('0x23')]();};}function saveUpdates(_0x4d30df,_0x190cf9){return function(_0x176055){if(_0x176055){return _0x176055['update'](_0x4d30df)[_0x502f('0x24')](function(_0xef7a4b){return _0xef7a4b;});}return null;};}function removeEntity(_0x3b540c,_0x94c91c){return function(_0xb6cfea){if(_0xb6cfea){return _0xb6cfea[_0x502f('0x25')]()['then'](function(){_0x3b540c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45bac6,_0x423a8d){return function(_0x4a9b32){if(!_0x4a9b32){_0x45bac6[_0x502f('0x1b')](0x194);}return _0x4a9b32;};}function handleError(_0x585389,_0x25a97e){_0x25a97e=_0x25a97e||0x1f4;return function(_0x10d637){logger['error'](_0x10d637[_0x502f('0x26')]);if(_0x10d637[_0x502f('0x27')]){delete _0x10d637[_0x502f('0x27')];}_0x585389['status'](_0x25a97e)[_0x502f('0x28')](_0x10d637);};}exports[_0x502f('0x29')]=function(_0x45badd,_0x3518a6){var _0x3036bc={},_0x60a1e8={},_0x54fa5b={'count':0x0,'rows':[]};var _0xa28cd=_[_0x502f('0x2a')](db[_0x502f('0x2b')][_0x502f('0x2c')],function(_0x9b6404){return{'name':_0x9b6404['fieldName'],'type':_0x9b6404['type'][_0x502f('0x2d')]};});_0x60a1e8[_0x502f('0x2e')]=_[_0x502f('0x2a')](_0xa28cd,_0x502f('0x27'));_0x60a1e8[_0x502f('0x2f')]=_[_0x502f('0x30')](_0x45badd[_0x502f('0x2f')]);_0x60a1e8[_0x502f('0x31')]=_['intersection'](_0x60a1e8[_0x502f('0x2e')],_0x60a1e8[_0x502f('0x2f')]);_0x3036bc['attributes']=_['intersection'](_0x60a1e8[_0x502f('0x2e')],qs[_0x502f('0x32')](_0x45badd[_0x502f('0x2f')][_0x502f('0x32')]));_0x3036bc[_0x502f('0x33')]=_0x3036bc[_0x502f('0x33')][_0x502f('0x34')]?_0x3036bc[_0x502f('0x33')]:_0x60a1e8[_0x502f('0x2e')];if(!_0x45badd['query'][_0x502f('0x35')]('nolimit')){_0x3036bc['limit']=qs[_0x502f('0x1f')](_0x45badd[_0x502f('0x2f')]['limit']);_0x3036bc[_0x502f('0x1d')]=qs[_0x502f('0x1d')](_0x45badd[_0x502f('0x2f')][_0x502f('0x1d')]);}_0x3036bc['order']=qs[_0x502f('0x36')](_0x45badd[_0x502f('0x2f')]['sort']);_0x3036bc[_0x502f('0x37')]=qs[_0x502f('0x31')](_[_0x502f('0x38')](_0x45badd[_0x502f('0x2f')],_0x60a1e8['filters']),_0xa28cd);if(_0x45badd[_0x502f('0x2f')][_0x502f('0x39')]){_0x3036bc['where']=_[_0x502f('0x3a')](_0x3036bc[_0x502f('0x37')],{'$or':_[_0x502f('0x2a')](_0xa28cd,function(_0x72e9cb){if(_0x72e9cb['type']!=='VIRTUAL'){var _0x58c443={};_0x58c443[_0x72e9cb[_0x502f('0x27')]]={'$like':'%'+_0x45badd[_0x502f('0x2f')]['filter']+'%'};return _0x58c443;}})});}_0x3036bc=_[_0x502f('0x3a')]({},_0x3036bc,_0x45badd[_0x502f('0x3b')]);var _0x1d58b6={'where':_0x3036bc[_0x502f('0x37')]};return db[_0x502f('0x2b')][_0x502f('0x20')](_0x1d58b6)[_0x502f('0x24')](function(_0x134539){_0x54fa5b['count']=_0x134539;if(_0x45badd['query'][_0x502f('0x3c')]){_0x3036bc['include']=[{'all':!![]}];}return db[_0x502f('0x2b')][_0x502f('0x3d')](_0x3036bc);})[_0x502f('0x24')](function(_0x429e50){_0x54fa5b[_0x502f('0x3e')]=_0x429e50;return _0x54fa5b;})[_0x502f('0x24')](respondWithFilteredResult(_0x3518a6,_0x3036bc))[_0x502f('0x3f')](handleError(_0x3518a6,null));};exports[_0x502f('0x40')]=function(_0x3e61cf,_0x48da5a){var _0x33706f={'raw':![],'where':{'id':_0x3e61cf[_0x502f('0x41')]['id']}},_0x219ff7={};_0x219ff7[_0x502f('0x2e')]=_['keys'](db[_0x502f('0x2b')][_0x502f('0x2c')]);_0x219ff7[_0x502f('0x2f')]=_[_0x502f('0x30')](_0x3e61cf[_0x502f('0x2f')]);_0x219ff7[_0x502f('0x31')]=_[_0x502f('0x42')](_0x219ff7['model'],_0x219ff7[_0x502f('0x2f')]);_0x33706f[_0x502f('0x33')]=_['intersection'](_0x219ff7['model'],qs[_0x502f('0x32')](_0x3e61cf['query'][_0x502f('0x32')]));_0x33706f[_0x502f('0x33')]=_0x33706f[_0x502f('0x33')][_0x502f('0x34')]?_0x33706f['attributes']:_0x219ff7['model'];if(_0x3e61cf[_0x502f('0x2f')][_0x502f('0x3c')]){_0x33706f['include']=[{'all':!![]}];}_0x33706f=_['merge']({},_0x33706f,_0x3e61cf[_0x502f('0x3b')]);return db['ZohoConfiguration'][_0x502f('0x43')](_0x33706f)[_0x502f('0x24')](handleEntityNotFound(_0x48da5a,null))[_0x502f('0x24')](respondWithResult(_0x48da5a,null))[_0x502f('0x3f')](handleError(_0x48da5a,null));};exports[_0x502f('0x44')]=function(_0x52efcc,_0x94e36){return db['ZohoConfiguration'][_0x502f('0x44')](_0x52efcc[_0x502f('0x45')],{})[_0x502f('0x24')](respondWithResult(_0x94e36,0xc9))[_0x502f('0x3f')](handleError(_0x94e36,null));};exports[_0x502f('0x46')]=function(_0x4733b0,_0x415628){if(_0x4733b0['body']['id']){delete _0x4733b0[_0x502f('0x45')]['id'];}return db['ZohoConfiguration'][_0x502f('0x43')]({'where':{'id':_0x4733b0['params']['id']}})[_0x502f('0x24')](handleEntityNotFound(_0x415628,null))[_0x502f('0x24')](saveUpdates(_0x4733b0[_0x502f('0x45')],null))[_0x502f('0x24')](respondWithResult(_0x415628,null))[_0x502f('0x3f')](handleError(_0x415628,null));};exports[_0x502f('0x25')]=function(_0x508ac1,_0x175516){return db['ZohoConfiguration'][_0x502f('0x43')]({'where':{'id':_0x508ac1['params']['id']}})[_0x502f('0x24')](handleEntityNotFound(_0x175516,null))[_0x502f('0x24')](removeEntity(_0x175516,null))[_0x502f('0x3f')](handleError(_0x175516,null));};exports[_0x502f('0x47')]=function(_0x2a74cf,_0x3b249a,_0x5f1001){var _0x5a2b6a={};var _0x3df9de={};var _0xa167bd;var _0x1dbbc4;return db[_0x502f('0x2b')][_0x502f('0x48')]({'where':{'id':_0x2a74cf['params']['id']}})[_0x502f('0x24')](handleEntityNotFound(_0x3b249a,null))[_0x502f('0x24')](function(_0x204fee){if(_0x204fee){_0xa167bd=_0x204fee;_0x3df9de[_0x502f('0x2e')]=_[_0x502f('0x30')](db[_0x502f('0x49')]['rawAttributes']);_0x3df9de[_0x502f('0x2f')]=_[_0x502f('0x30')](_0x2a74cf[_0x502f('0x2f')]);_0x3df9de[_0x502f('0x31')]=_['intersection'](_0x3df9de[_0x502f('0x2e')],_0x3df9de[_0x502f('0x2f')]);_0x5a2b6a['attributes']=_[_0x502f('0x42')](_0x3df9de['model'],qs[_0x502f('0x32')](_0x2a74cf['query'][_0x502f('0x32')]));_0x5a2b6a['attributes']=_0x5a2b6a['attributes']['length']?_0x5a2b6a[_0x502f('0x33')]:_0x3df9de[_0x502f('0x2e')];_0x5a2b6a[_0x502f('0x4a')]=qs[_0x502f('0x36')](_0x2a74cf['query'][_0x502f('0x36')]);_0x5a2b6a['where']=qs[_0x502f('0x31')](_[_0x502f('0x38')](_0x2a74cf['query'],_0x3df9de[_0x502f('0x31')]));if(_0x2a74cf[_0x502f('0x2f')][_0x502f('0x39')]){_0x5a2b6a[_0x502f('0x37')]=_[_0x502f('0x3a')](_0x5a2b6a[_0x502f('0x37')],{'$or':_[_0x502f('0x2a')](_0x5a2b6a[_0x502f('0x33')],function(_0x332add){var _0x4e4d0b={};_0x4e4d0b[_0x332add]={'$like':'%'+_0x2a74cf[_0x502f('0x2f')]['filter']+'%'};return _0x4e4d0b;})});}_0x5a2b6a=_[_0x502f('0x3a')]({},_0x5a2b6a,_0x2a74cf[_0x502f('0x3b')]);return _0xa167bd[_0x502f('0x47')](_0x5a2b6a);}})['then'](function(_0x468a06){if(_0x468a06){_0x1dbbc4=_0x468a06[_0x502f('0x34')];if(!_0x2a74cf['query'][_0x502f('0x35')](_0x502f('0x4b'))){_0x5a2b6a['limit']=qs['limit'](_0x2a74cf[_0x502f('0x2f')][_0x502f('0x1f')]);_0x5a2b6a[_0x502f('0x1d')]=qs[_0x502f('0x1d')](_0x2a74cf[_0x502f('0x2f')]['offset']);}return _0xa167bd['getFields'](_0x5a2b6a);}})[_0x502f('0x24')](function(_0x176737){if(_0x176737){return _0x176737?{'count':_0x1dbbc4,'rows':_0x176737}:null;}})[_0x502f('0x24')](respondWithResult(_0x3b249a,null))[_0x502f('0x3f')](handleError(_0x3b249a,null));};exports[_0x502f('0x4c')]=function(_0x2a66ae,_0x15f17f,_0xf28153){var _0x308929={};var _0x17ee21={};var _0x10940c;var _0x1e5ee5;return db[_0x502f('0x2b')][_0x502f('0x48')]({'where':{'id':_0x2a66ae[_0x502f('0x41')]['id']}})['then'](handleEntityNotFound(_0x15f17f,null))[_0x502f('0x24')](function(_0x2196dd){if(_0x2196dd){_0x10940c=_0x2196dd;_0x17ee21[_0x502f('0x2e')]=_['keys'](db[_0x502f('0x49')]['rawAttributes']);_0x17ee21[_0x502f('0x2f')]=_[_0x502f('0x30')](_0x2a66ae[_0x502f('0x2f')]);_0x17ee21[_0x502f('0x31')]=_['intersection'](_0x17ee21[_0x502f('0x2e')],_0x17ee21[_0x502f('0x2f')]);_0x308929[_0x502f('0x33')]=_[_0x502f('0x42')](_0x17ee21[_0x502f('0x2e')],qs['fields'](_0x2a66ae[_0x502f('0x2f')][_0x502f('0x32')]));_0x308929[_0x502f('0x33')]=_0x308929[_0x502f('0x33')][_0x502f('0x34')]?_0x308929['attributes']:_0x17ee21[_0x502f('0x2e')];_0x308929['order']=qs[_0x502f('0x36')](_0x2a66ae[_0x502f('0x2f')][_0x502f('0x36')]);_0x308929['where']=qs[_0x502f('0x31')](_[_0x502f('0x38')](_0x2a66ae['query'],_0x17ee21['filters']));if(_0x2a66ae[_0x502f('0x2f')][_0x502f('0x39')]){_0x308929[_0x502f('0x37')]=_[_0x502f('0x3a')](_0x308929[_0x502f('0x37')],{'$or':_[_0x502f('0x2a')](_0x308929[_0x502f('0x33')],function(_0x53d776){var _0x31e407={};_0x31e407[_0x53d776]={'$like':'%'+_0x2a66ae['query'][_0x502f('0x39')]+'%'};return _0x31e407;})});}_0x308929=_[_0x502f('0x3a')]({},_0x308929,_0x2a66ae[_0x502f('0x3b')]);return _0x10940c[_0x502f('0x4c')](_0x308929);}})[_0x502f('0x24')](function(_0x496f7f){if(_0x496f7f){_0x1e5ee5=_0x496f7f[_0x502f('0x34')];if(!_0x2a66ae[_0x502f('0x2f')]['hasOwnProperty'](_0x502f('0x4b'))){_0x308929[_0x502f('0x1f')]=qs[_0x502f('0x1f')](_0x2a66ae[_0x502f('0x2f')]['limit']);_0x308929[_0x502f('0x1d')]=qs[_0x502f('0x1d')](_0x2a66ae[_0x502f('0x2f')][_0x502f('0x1d')]);}return _0x10940c['getSubjects'](_0x308929);}})[_0x502f('0x24')](function(_0x314ccc){if(_0x314ccc){return _0x314ccc?{'count':_0x1e5ee5,'rows':_0x314ccc}:null;}})[_0x502f('0x24')](respondWithResult(_0x15f17f,null))[_0x502f('0x3f')](handleError(_0x15f17f,null));};exports[_0x502f('0x4d')]=function(_0xabed49,_0x3536b9,_0x18f0f4){var _0x3e20dd={};var _0x4a6525={};var _0x2492c1;var _0x3ce344;return db[_0x502f('0x2b')]['findOne']({'where':{'id':_0xabed49['params']['id']}})['then'](handleEntityNotFound(_0x3536b9,null))[_0x502f('0x24')](function(_0x15e8b9){if(_0x15e8b9){_0x2492c1=_0x15e8b9;_0x4a6525[_0x502f('0x2e')]=_[_0x502f('0x30')](db[_0x502f('0x49')][_0x502f('0x2c')]);_0x4a6525[_0x502f('0x2f')]=_[_0x502f('0x30')](_0xabed49['query']);_0x4a6525[_0x502f('0x31')]=_[_0x502f('0x42')](_0x4a6525[_0x502f('0x2e')],_0x4a6525[_0x502f('0x2f')]);_0x3e20dd[_0x502f('0x33')]=_[_0x502f('0x42')](_0x4a6525[_0x502f('0x2e')],qs[_0x502f('0x32')](_0xabed49['query'][_0x502f('0x32')]));_0x3e20dd[_0x502f('0x33')]=_0x3e20dd[_0x502f('0x33')][_0x502f('0x34')]?_0x3e20dd[_0x502f('0x33')]:_0x4a6525[_0x502f('0x2e')];_0x3e20dd[_0x502f('0x4a')]=qs[_0x502f('0x36')](_0xabed49[_0x502f('0x2f')][_0x502f('0x36')]);_0x3e20dd[_0x502f('0x37')]=qs[_0x502f('0x31')](_[_0x502f('0x38')](_0xabed49[_0x502f('0x2f')],_0x4a6525[_0x502f('0x31')]));if(_0xabed49[_0x502f('0x2f')][_0x502f('0x39')]){_0x3e20dd[_0x502f('0x37')]=_['merge'](_0x3e20dd['where'],{'$or':_[_0x502f('0x2a')](_0x3e20dd[_0x502f('0x33')],function(_0x3e0794){var _0x36bef6={};_0x36bef6[_0x3e0794]={'$like':'%'+_0xabed49['query']['filter']+'%'};return _0x36bef6;})});}_0x3e20dd=_[_0x502f('0x3a')]({},_0x3e20dd,_0xabed49[_0x502f('0x3b')]);return _0x2492c1[_0x502f('0x4d')](_0x3e20dd);}})[_0x502f('0x24')](function(_0x37fb44){if(_0x37fb44){_0x3ce344=_0x37fb44[_0x502f('0x34')];if(!_0xabed49[_0x502f('0x2f')][_0x502f('0x35')](_0x502f('0x4b'))){_0x3e20dd[_0x502f('0x1f')]=qs['limit'](_0xabed49['query']['limit']);_0x3e20dd[_0x502f('0x1d')]=qs['offset'](_0xabed49[_0x502f('0x2f')][_0x502f('0x1d')]);}return _0x2492c1[_0x502f('0x4d')](_0x3e20dd);}})[_0x502f('0x24')](function(_0x471e7a){if(_0x471e7a){return _0x471e7a?{'count':_0x3ce344,'rows':_0x471e7a}:null;}})['then'](respondWithResult(_0x3536b9,null))[_0x502f('0x3f')](handleError(_0x3536b9,null));};
\ No newline at end of file
+var _0x343a=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ZohoConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','getFields','findOne','nolimit','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x447550,_0x477c3b){var _0x50ce12=function(_0x1941da){while(--_0x1941da){_0x447550['push'](_0x447550['shift']());}};_0x50ce12(++_0x477c3b);}(_0x343a,0x87));var _0xa343=function(_0x2585ef,_0x3b2545){_0x2585ef=_0x2585ef-0x0;var _0x5db7e4=_0x343a[_0x2585ef];return _0x5db7e4;};'use strict';var emlformat=require(_0xa343('0x0'));var rimraf=require(_0xa343('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa343('0x2'));var rp=require('request-promise');var moment=require(_0xa343('0x3'));var BPromise=require(_0xa343('0x4'));var Mustache=require(_0xa343('0x5'));var util=require(_0xa343('0x6'));var path=require(_0xa343('0x7'));var sox=require(_0xa343('0x8'));var csv=require(_0xa343('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa343('0xa'));var crypto=require(_0xa343('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa343('0xc'));var toCsv=require(_0xa343('0x9'));var querystring=require(_0xa343('0xd'));var Papa=require(_0xa343('0xe'));var Redis=require(_0xa343('0xf'));var authService=require(_0xa343('0x10'));var qs=require(_0xa343('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa343('0x12'));var logger=require('../../config/logger')(_0xa343('0x13'));var utils=require(_0xa343('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa343('0x15'));var db=require(_0xa343('0x16'))['db'];function respondWithStatusCode(_0x200855,_0x1779fb){_0x1779fb=_0x1779fb||0xcc;return function(_0x323422){if(_0x323422){return _0x200855[_0xa343('0x17')](_0x1779fb);}return _0x200855[_0xa343('0x18')](_0x1779fb)[_0xa343('0x19')]();};}function respondWithResult(_0x229666,_0x320573){_0x320573=_0x320573||0xc8;return function(_0x2e1d0b){if(_0x2e1d0b){return _0x229666['status'](_0x320573)['json'](_0x2e1d0b);}};}function respondWithFilteredResult(_0x5f5b47,_0x2d1239){return function(_0x30c6c0){if(_0x30c6c0){var _0x413141=typeof _0x2d1239[_0xa343('0x1a')]===_0xa343('0x1b')&&typeof _0x2d1239[_0xa343('0x1c')]===_0xa343('0x1b');var _0x376541=_0x30c6c0[_0xa343('0x1d')];var _0x5ca186=_0x413141?0x0:_0x2d1239[_0xa343('0x1a')];var _0x47c86e=_0x413141?_0x30c6c0[_0xa343('0x1d')]:_0x2d1239[_0xa343('0x1a')]+_0x2d1239[_0xa343('0x1c')];var _0x2585c6;if(_0x47c86e>=_0x376541){_0x47c86e=_0x376541;_0x2585c6=0xc8;}else{_0x2585c6=0xce;}_0x5f5b47[_0xa343('0x18')](_0x2585c6);return _0x5f5b47[_0xa343('0x1e')](_0xa343('0x1f'),_0x5ca186+'-'+_0x47c86e+'/'+_0x376541)['json'](_0x30c6c0);}return null;};}function patchUpdates(_0x4fa306){return function(_0x2a5d6a){try{jsonpatch[_0xa343('0x20')](_0x2a5d6a,_0x4fa306,!![]);}catch(_0xd9a27){return BPromise['reject'](_0xd9a27);}return _0x2a5d6a[_0xa343('0x21')]();};}function saveUpdates(_0x5ec1da,_0x526fb3){return function(_0x39763d){if(_0x39763d){return _0x39763d[_0xa343('0x22')](_0x5ec1da)[_0xa343('0x23')](function(_0x44a509){return _0x44a509;});}return null;};}function removeEntity(_0x126855,_0x1fe076){return function(_0x12916c){if(_0x12916c){return _0x12916c['destroy']()[_0xa343('0x23')](function(){_0x126855['status'](0xcc)[_0xa343('0x19')]();});}};}function handleEntityNotFound(_0x1f66d9,_0x38dfb1){return function(_0x102455){if(!_0x102455){_0x1f66d9[_0xa343('0x17')](0x194);}return _0x102455;};}function handleError(_0x959d88,_0x4bca90){_0x4bca90=_0x4bca90||0x1f4;return function(_0x161363){logger[_0xa343('0x24')](_0x161363[_0xa343('0x25')]);if(_0x161363['name']){delete _0x161363[_0xa343('0x26')];}_0x959d88[_0xa343('0x18')](_0x4bca90)['send'](_0x161363);};}exports[_0xa343('0x27')]=function(_0x5d8d25,_0x5d35b8){var _0x365e7e={},_0x1d7a60={},_0x440edb={'count':0x0,'rows':[]};var _0xcfd981=_[_0xa343('0x28')](db[_0xa343('0x29')][_0xa343('0x2a')],function(_0x558bbe){return{'name':_0x558bbe['fieldName'],'type':_0x558bbe[_0xa343('0x2b')][_0xa343('0x2c')]};});_0x1d7a60['model']=_[_0xa343('0x28')](_0xcfd981,_0xa343('0x26'));_0x1d7a60[_0xa343('0x2d')]=_[_0xa343('0x2e')](_0x5d8d25[_0xa343('0x2d')]);_0x1d7a60[_0xa343('0x2f')]=_[_0xa343('0x30')](_0x1d7a60[_0xa343('0x31')],_0x1d7a60['query']);_0x365e7e[_0xa343('0x32')]=_[_0xa343('0x30')](_0x1d7a60['model'],qs['fields'](_0x5d8d25[_0xa343('0x2d')]['fields']));_0x365e7e['attributes']=_0x365e7e[_0xa343('0x32')][_0xa343('0x33')]?_0x365e7e[_0xa343('0x32')]:_0x1d7a60[_0xa343('0x31')];if(!_0x5d8d25[_0xa343('0x2d')][_0xa343('0x34')]('nolimit')){_0x365e7e[_0xa343('0x1c')]=qs[_0xa343('0x1c')](_0x5d8d25[_0xa343('0x2d')][_0xa343('0x1c')]);_0x365e7e['offset']=qs[_0xa343('0x1a')](_0x5d8d25[_0xa343('0x2d')]['offset']);}_0x365e7e[_0xa343('0x35')]=qs[_0xa343('0x36')](_0x5d8d25[_0xa343('0x2d')][_0xa343('0x36')]);_0x365e7e[_0xa343('0x37')]=qs[_0xa343('0x2f')](_[_0xa343('0x38')](_0x5d8d25['query'],_0x1d7a60[_0xa343('0x2f')]),_0xcfd981);if(_0x5d8d25[_0xa343('0x2d')][_0xa343('0x39')]){_0x365e7e[_0xa343('0x37')]=_[_0xa343('0x3a')](_0x365e7e[_0xa343('0x37')],{'$or':_[_0xa343('0x28')](_0xcfd981,function(_0x469a90){if(_0x469a90[_0xa343('0x2b')]!==_0xa343('0x3b')){var _0x550ca8={};_0x550ca8[_0x469a90[_0xa343('0x26')]]={'$like':'%'+_0x5d8d25['query'][_0xa343('0x39')]+'%'};return _0x550ca8;}})});}_0x365e7e=_['merge']({},_0x365e7e,_0x5d8d25[_0xa343('0x3c')]);var _0x21a67d={'where':_0x365e7e[_0xa343('0x37')]};return db[_0xa343('0x29')][_0xa343('0x1d')](_0x21a67d)[_0xa343('0x23')](function(_0xee6a1d){_0x440edb['count']=_0xee6a1d;if(_0x5d8d25[_0xa343('0x2d')][_0xa343('0x3d')]){_0x365e7e[_0xa343('0x3e')]=[{'all':!![]}];}return db[_0xa343('0x29')][_0xa343('0x3f')](_0x365e7e);})[_0xa343('0x23')](function(_0x411956){_0x440edb[_0xa343('0x40')]=_0x411956;return _0x440edb;})['then'](respondWithFilteredResult(_0x5d35b8,_0x365e7e))[_0xa343('0x41')](handleError(_0x5d35b8,null));};exports[_0xa343('0x42')]=function(_0x31774d,_0x217dbd){var _0x2d2ea8={'raw':![],'where':{'id':_0x31774d[_0xa343('0x43')]['id']}},_0x4be925={};_0x4be925[_0xa343('0x31')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x4be925['query']=_[_0xa343('0x2e')](_0x31774d[_0xa343('0x2d')]);_0x4be925[_0xa343('0x2f')]=_[_0xa343('0x30')](_0x4be925[_0xa343('0x31')],_0x4be925[_0xa343('0x2d')]);_0x2d2ea8[_0xa343('0x32')]=_[_0xa343('0x30')](_0x4be925[_0xa343('0x31')],qs[_0xa343('0x44')](_0x31774d[_0xa343('0x2d')][_0xa343('0x44')]));_0x2d2ea8[_0xa343('0x32')]=_0x2d2ea8['attributes']['length']?_0x2d2ea8[_0xa343('0x32')]:_0x4be925['model'];if(_0x31774d[_0xa343('0x2d')][_0xa343('0x3d')]){_0x2d2ea8[_0xa343('0x3e')]=[{'all':!![]}];}_0x2d2ea8=_[_0xa343('0x3a')]({},_0x2d2ea8,_0x31774d[_0xa343('0x3c')]);return db[_0xa343('0x29')][_0xa343('0x45')](_0x2d2ea8)[_0xa343('0x23')](handleEntityNotFound(_0x217dbd,null))[_0xa343('0x23')](respondWithResult(_0x217dbd,null))[_0xa343('0x41')](handleError(_0x217dbd,null));};exports[_0xa343('0x46')]=function(_0x1f8ba1,_0x5be8f5){return db[_0xa343('0x29')][_0xa343('0x46')](_0x1f8ba1['body'],{})[_0xa343('0x23')](respondWithResult(_0x5be8f5,0xc9))[_0xa343('0x41')](handleError(_0x5be8f5,null));};exports[_0xa343('0x22')]=function(_0xcd64ed,_0x29f7ac){if(_0xcd64ed[_0xa343('0x47')]['id']){delete _0xcd64ed['body']['id'];}return db[_0xa343('0x29')]['find']({'where':{'id':_0xcd64ed[_0xa343('0x43')]['id']}})[_0xa343('0x23')](handleEntityNotFound(_0x29f7ac,null))[_0xa343('0x23')](saveUpdates(_0xcd64ed[_0xa343('0x47')],null))[_0xa343('0x23')](respondWithResult(_0x29f7ac,null))[_0xa343('0x41')](handleError(_0x29f7ac,null));};exports['destroy']=function(_0x547116,_0x29cbfc){return db['ZohoConfiguration'][_0xa343('0x45')]({'where':{'id':_0x547116[_0xa343('0x43')]['id']}})['then'](handleEntityNotFound(_0x29cbfc,null))[_0xa343('0x23')](removeEntity(_0x29cbfc,null))[_0xa343('0x41')](handleError(_0x29cbfc,null));};exports[_0xa343('0x48')]=function(_0x52c474,_0x3ccc36,_0x800bf7){var _0x23244c={};var _0x564e2b={};var _0x4b4601;var _0x3691ec;return db[_0xa343('0x29')][_0xa343('0x49')]({'where':{'id':_0x52c474[_0xa343('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ccc36,null))['then'](function(_0x50df8f){if(_0x50df8f){_0x4b4601=_0x50df8f;_0x564e2b['model']=_[_0xa343('0x2e')](db['ZohoField'][_0xa343('0x2a')]);_0x564e2b[_0xa343('0x2d')]=_[_0xa343('0x2e')](_0x52c474['query']);_0x564e2b[_0xa343('0x2f')]=_[_0xa343('0x30')](_0x564e2b[_0xa343('0x31')],_0x564e2b['query']);_0x23244c[_0xa343('0x32')]=_[_0xa343('0x30')](_0x564e2b[_0xa343('0x31')],qs[_0xa343('0x44')](_0x52c474[_0xa343('0x2d')]['fields']));_0x23244c[_0xa343('0x32')]=_0x23244c[_0xa343('0x32')][_0xa343('0x33')]?_0x23244c['attributes']:_0x564e2b[_0xa343('0x31')];_0x23244c[_0xa343('0x35')]=qs[_0xa343('0x36')](_0x52c474['query']['sort']);_0x23244c[_0xa343('0x37')]=qs['filters'](_[_0xa343('0x38')](_0x52c474[_0xa343('0x2d')],_0x564e2b[_0xa343('0x2f')]));if(_0x52c474[_0xa343('0x2d')][_0xa343('0x39')]){_0x23244c[_0xa343('0x37')]=_['merge'](_0x23244c[_0xa343('0x37')],{'$or':_['map'](_0x23244c[_0xa343('0x32')],function(_0x2df441){var _0x1e395d={};_0x1e395d[_0x2df441]={'$like':'%'+_0x52c474[_0xa343('0x2d')][_0xa343('0x39')]+'%'};return _0x1e395d;})});}_0x23244c=_[_0xa343('0x3a')]({},_0x23244c,_0x52c474[_0xa343('0x3c')]);return _0x4b4601[_0xa343('0x48')](_0x23244c);}})[_0xa343('0x23')](function(_0x342a44){if(_0x342a44){_0x3691ec=_0x342a44[_0xa343('0x33')];if(!_0x52c474['query']['hasOwnProperty'](_0xa343('0x4a'))){_0x23244c[_0xa343('0x1c')]=qs[_0xa343('0x1c')](_0x52c474['query'][_0xa343('0x1c')]);_0x23244c[_0xa343('0x1a')]=qs[_0xa343('0x1a')](_0x52c474[_0xa343('0x2d')][_0xa343('0x1a')]);}return _0x4b4601[_0xa343('0x48')](_0x23244c);}})['then'](function(_0x12ed42){if(_0x12ed42){return _0x12ed42?{'count':_0x3691ec,'rows':_0x12ed42}:null;}})[_0xa343('0x23')](respondWithResult(_0x3ccc36,null))['catch'](handleError(_0x3ccc36,null));};exports[_0xa343('0x4b')]=function(_0xe5a99f,_0x21c68d,_0x2776a6){var _0x3222f2={};var _0x2cb399={};var _0x2b8f01;var _0x592e19;return db[_0xa343('0x29')]['findOne']({'where':{'id':_0xe5a99f[_0xa343('0x43')]['id']}})[_0xa343('0x23')](handleEntityNotFound(_0x21c68d,null))[_0xa343('0x23')](function(_0x1d3ce2){if(_0x1d3ce2){_0x2b8f01=_0x1d3ce2;_0x2cb399[_0xa343('0x31')]=_[_0xa343('0x2e')](db[_0xa343('0x4c')]['rawAttributes']);_0x2cb399[_0xa343('0x2d')]=_[_0xa343('0x2e')](_0xe5a99f[_0xa343('0x2d')]);_0x2cb399['filters']=_[_0xa343('0x30')](_0x2cb399[_0xa343('0x31')],_0x2cb399[_0xa343('0x2d')]);_0x3222f2[_0xa343('0x32')]=_[_0xa343('0x30')](_0x2cb399['model'],qs[_0xa343('0x44')](_0xe5a99f[_0xa343('0x2d')][_0xa343('0x44')]));_0x3222f2[_0xa343('0x32')]=_0x3222f2[_0xa343('0x32')][_0xa343('0x33')]?_0x3222f2[_0xa343('0x32')]:_0x2cb399[_0xa343('0x31')];_0x3222f2['order']=qs[_0xa343('0x36')](_0xe5a99f[_0xa343('0x2d')][_0xa343('0x36')]);_0x3222f2[_0xa343('0x37')]=qs['filters'](_[_0xa343('0x38')](_0xe5a99f[_0xa343('0x2d')],_0x2cb399['filters']));if(_0xe5a99f[_0xa343('0x2d')]['filter']){_0x3222f2[_0xa343('0x37')]=_['merge'](_0x3222f2['where'],{'$or':_[_0xa343('0x28')](_0x3222f2[_0xa343('0x32')],function(_0xa20e80){var _0x568c5e={};_0x568c5e[_0xa20e80]={'$like':'%'+_0xe5a99f[_0xa343('0x2d')]['filter']+'%'};return _0x568c5e;})});}_0x3222f2=_[_0xa343('0x3a')]({},_0x3222f2,_0xe5a99f['options']);return _0x2b8f01[_0xa343('0x4b')](_0x3222f2);}})[_0xa343('0x23')](function(_0x466c8a){if(_0x466c8a){_0x592e19=_0x466c8a[_0xa343('0x33')];if(!_0xe5a99f[_0xa343('0x2d')][_0xa343('0x34')]('nolimit')){_0x3222f2[_0xa343('0x1c')]=qs[_0xa343('0x1c')](_0xe5a99f['query'][_0xa343('0x1c')]);_0x3222f2[_0xa343('0x1a')]=qs[_0xa343('0x1a')](_0xe5a99f[_0xa343('0x2d')][_0xa343('0x1a')]);}return _0x2b8f01[_0xa343('0x4b')](_0x3222f2);}})['then'](function(_0x162f9d){if(_0x162f9d){return _0x162f9d?{'count':_0x592e19,'rows':_0x162f9d}:null;}})['then'](respondWithResult(_0x21c68d,null))[_0xa343('0x41')](handleError(_0x21c68d,null));};exports[_0xa343('0x4d')]=function(_0x391a06,_0x5d117d,_0x27ece7){var _0x4d2b4b={};var _0x53d17a={};var _0x5972b9;var _0x221ab8;return db[_0xa343('0x29')][_0xa343('0x49')]({'where':{'id':_0x391a06['params']['id']}})[_0xa343('0x23')](handleEntityNotFound(_0x5d117d,null))['then'](function(_0x5b9e11){if(_0x5b9e11){_0x5972b9=_0x5b9e11;_0x53d17a[_0xa343('0x31')]=_['keys'](db['ZohoField'][_0xa343('0x2a')]);_0x53d17a[_0xa343('0x2d')]=_['keys'](_0x391a06[_0xa343('0x2d')]);_0x53d17a['filters']=_['intersection'](_0x53d17a['model'],_0x53d17a[_0xa343('0x2d')]);_0x4d2b4b[_0xa343('0x32')]=_[_0xa343('0x30')](_0x53d17a[_0xa343('0x31')],qs['fields'](_0x391a06[_0xa343('0x2d')][_0xa343('0x44')]));_0x4d2b4b[_0xa343('0x32')]=_0x4d2b4b[_0xa343('0x32')][_0xa343('0x33')]?_0x4d2b4b[_0xa343('0x32')]:_0x53d17a[_0xa343('0x31')];_0x4d2b4b[_0xa343('0x35')]=qs[_0xa343('0x36')](_0x391a06[_0xa343('0x2d')][_0xa343('0x36')]);_0x4d2b4b[_0xa343('0x37')]=qs[_0xa343('0x2f')](_[_0xa343('0x38')](_0x391a06['query'],_0x53d17a['filters']));if(_0x391a06[_0xa343('0x2d')][_0xa343('0x39')]){_0x4d2b4b['where']=_[_0xa343('0x3a')](_0x4d2b4b[_0xa343('0x37')],{'$or':_[_0xa343('0x28')](_0x4d2b4b['attributes'],function(_0x5b0377){var _0x39ed30={};_0x39ed30[_0x5b0377]={'$like':'%'+_0x391a06[_0xa343('0x2d')]['filter']+'%'};return _0x39ed30;})});}_0x4d2b4b=_['merge']({},_0x4d2b4b,_0x391a06[_0xa343('0x3c')]);return _0x5972b9[_0xa343('0x4d')](_0x4d2b4b);}})[_0xa343('0x23')](function(_0x44ebb7){if(_0x44ebb7){_0x221ab8=_0x44ebb7[_0xa343('0x33')];if(!_0x391a06[_0xa343('0x2d')][_0xa343('0x34')](_0xa343('0x4a'))){_0x4d2b4b[_0xa343('0x1c')]=qs['limit'](_0x391a06[_0xa343('0x2d')][_0xa343('0x1c')]);_0x4d2b4b[_0xa343('0x1a')]=qs['offset'](_0x391a06[_0xa343('0x2d')][_0xa343('0x1a')]);}return _0x5972b9['getDescriptions'](_0x4d2b4b);}})[_0xa343('0x23')](function(_0x3497f8){if(_0x3497f8){return _0x3497f8?{'count':_0x221ab8,'rows':_0x3497f8}:null;}})[_0xa343('0x23')](respondWithResult(_0x5d117d,null))[_0xa343('0x41')](handleError(_0x5d117d,null));};
\ No newline at end of file