Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / api / intZohoField / intZohoField.controller.js
index 29dd7a1..28d2524 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ca0=['rows','catch','show','keys','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll'];(function(_0x2db570,_0x1642c1){var _0x42909e=function(_0xf5ce7c){while(--_0xf5ce7c){_0x2db570['push'](_0x2db570['shift']());}};_0x42909e(++_0x1642c1);}(_0x1ca0,0xdd));var _0x01ca=function(_0x1489ef,_0x275d93){_0x1489ef=_0x1489ef-0x0;var _0x20e0e6=_0x1ca0[_0x1489ef];return _0x20e0e6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x01ca('0x0'));var rimraf=require(_0x01ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01ca('0x2'));var rp=require(_0x01ca('0x3'));var moment=require('moment');var BPromise=require(_0x01ca('0x4'));var Mustache=require(_0x01ca('0x5'));var util=require('util');var path=require(_0x01ca('0x6'));var sox=require(_0x01ca('0x7'));var csv=require(_0x01ca('0x8'));var ejs=require(_0x01ca('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x01ca('0xa'));var crypto=require(_0x01ca('0xb'));var jsforce=require(_0x01ca('0xc'));var deskjs=require(_0x01ca('0xd'));var toCsv=require(_0x01ca('0x8'));var querystring=require(_0x01ca('0xe'));var Papa=require('papaparse');var Redis=require(_0x01ca('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x01ca('0x10'));var logger=require(_0x01ca('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x01ca('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x01ca('0x13'))['db'];function respondWithStatusCode(_0x1b0f3b,_0x5f0997){_0x5f0997=_0x5f0997||0xcc;return function(_0x595a2d){if(_0x595a2d){return _0x1b0f3b[_0x01ca('0x14')](_0x5f0997);}return _0x1b0f3b['status'](_0x5f0997)[_0x01ca('0x15')]();};}function respondWithResult(_0x28b7e6,_0x28e60b){_0x28e60b=_0x28e60b||0xc8;return function(_0x38af09){if(_0x38af09){return _0x28b7e6['status'](_0x28e60b)[_0x01ca('0x16')](_0x38af09);}};}function respondWithFilteredResult(_0x11630f,_0x41d836){return function(_0x417231){if(_0x417231){var _0x5e67f6=_0x417231[_0x01ca('0x17')],_0x3d28df=_0x41d836[_0x01ca('0x18')],_0xa7793b=_0x41d836[_0x01ca('0x18')]+_0x41d836[_0x01ca('0x19')],_0x4f5444;if(_0xa7793b>=_0x5e67f6){_0xa7793b=_0x5e67f6;_0x4f5444=0xc8;}else{_0x4f5444=0xce;}_0x11630f[_0x01ca('0x1a')](_0x4f5444);return _0x11630f[_0x01ca('0x1b')](_0x01ca('0x1c'),_0x3d28df+'-'+_0xa7793b+'/'+_0x5e67f6)[_0x01ca('0x16')](_0x417231);}return null;};}function patchUpdates(_0x34074c){return function(_0x312aea){try{jsonpatch[_0x01ca('0x1d')](_0x312aea,_0x34074c,!![]);}catch(_0x57e0f3){return BPromise[_0x01ca('0x1e')](_0x57e0f3);}return _0x312aea['save']();};}function saveUpdates(_0x1205b0,_0x16a7b1){return function(_0x3eb099){if(_0x3eb099){return _0x3eb099[_0x01ca('0x1f')](_0x1205b0)[_0x01ca('0x20')](function(_0x61fafa){return _0x61fafa;});}return null;};}function removeEntity(_0x4a9225,_0x5f23c3){return function(_0x38dcfd){if(_0x38dcfd){return _0x38dcfd[_0x01ca('0x21')]()[_0x01ca('0x20')](function(){_0x4a9225['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45798b,_0x1e7a10){return function(_0x43bca5){if(!_0x43bca5){_0x45798b[_0x01ca('0x14')](0x194);}return _0x43bca5;};}function handleError(_0x186eeb,_0x5c0e7d){_0x5c0e7d=_0x5c0e7d||0x1f4;return function(_0xd1a7b5){logger['error'](_0xd1a7b5[_0x01ca('0x22')]);if(_0xd1a7b5[_0x01ca('0x23')]){delete _0xd1a7b5[_0x01ca('0x23')];}_0x186eeb[_0x01ca('0x1a')](_0x5c0e7d)[_0x01ca('0x24')](_0xd1a7b5);};}exports[_0x01ca('0x25')]=function(_0x130519,_0x3f33c3){var _0x5e9450={},_0x1ae3bf={},_0x2eaf1e={'count':0x0,'rows':[]};var _0x5b10b8=_[_0x01ca('0x26')](db[_0x01ca('0x27')][_0x01ca('0x28')],function(_0x14abbd){return{'name':_0x14abbd[_0x01ca('0x29')],'type':_0x14abbd[_0x01ca('0x2a')][_0x01ca('0x2b')]};});_0x1ae3bf['model']=_[_0x01ca('0x26')](_0x5b10b8,_0x01ca('0x23'));_0x1ae3bf[_0x01ca('0x2c')]=_['keys'](_0x130519[_0x01ca('0x2c')]);_0x1ae3bf['filters']=_['intersection'](_0x1ae3bf[_0x01ca('0x2d')],_0x1ae3bf[_0x01ca('0x2c')]);_0x5e9450[_0x01ca('0x2e')]=_[_0x01ca('0x2f')](_0x1ae3bf[_0x01ca('0x2d')],qs[_0x01ca('0x30')](_0x130519[_0x01ca('0x2c')][_0x01ca('0x30')]));_0x5e9450[_0x01ca('0x2e')]=_0x5e9450['attributes'][_0x01ca('0x31')]?_0x5e9450[_0x01ca('0x2e')]:_0x1ae3bf[_0x01ca('0x2d')];if(!_0x130519[_0x01ca('0x2c')][_0x01ca('0x32')](_0x01ca('0x33'))){_0x5e9450[_0x01ca('0x19')]=qs[_0x01ca('0x19')](_0x130519[_0x01ca('0x2c')][_0x01ca('0x19')]);_0x5e9450[_0x01ca('0x18')]=qs[_0x01ca('0x18')](_0x130519[_0x01ca('0x2c')]['offset']);}_0x5e9450[_0x01ca('0x34')]=qs[_0x01ca('0x35')](_0x130519[_0x01ca('0x2c')][_0x01ca('0x35')]);_0x5e9450['where']=qs[_0x01ca('0x36')](_[_0x01ca('0x37')](_0x130519[_0x01ca('0x2c')],_0x1ae3bf[_0x01ca('0x36')]),_0x5b10b8);if(_0x130519[_0x01ca('0x2c')][_0x01ca('0x38')]){_0x5e9450[_0x01ca('0x39')]=_['merge'](_0x5e9450[_0x01ca('0x39')],{'$or':_[_0x01ca('0x26')](_0x5b10b8,function(_0x303e46){if(_0x303e46[_0x01ca('0x2a')]!=='VIRTUAL'){var _0x80a967={};_0x80a967[_0x303e46[_0x01ca('0x23')]]={'$like':'%'+_0x130519['query']['filter']+'%'};return _0x80a967;}})});}_0x5e9450=_[_0x01ca('0x3a')]({},_0x5e9450,_0x130519[_0x01ca('0x3b')]);var _0x1b38e8={'where':_0x5e9450['where']};return db['ZohoField'][_0x01ca('0x17')](_0x1b38e8)[_0x01ca('0x20')](function(_0x12ff12){_0x2eaf1e['count']=_0x12ff12;if(_0x130519[_0x01ca('0x2c')][_0x01ca('0x3c')]){_0x5e9450[_0x01ca('0x3d')]=[{'all':!![]}];}return db[_0x01ca('0x27')][_0x01ca('0x3e')](_0x5e9450);})[_0x01ca('0x20')](function(_0x5ed8d6){_0x2eaf1e[_0x01ca('0x3f')]=_0x5ed8d6;return _0x2eaf1e;})[_0x01ca('0x20')](respondWithFilteredResult(_0x3f33c3,_0x5e9450))[_0x01ca('0x40')](handleError(_0x3f33c3,null));};exports[_0x01ca('0x41')]=function(_0x274a90,_0x2d20ab){var _0x549f5b={'raw':!![],'where':{'id':_0x274a90['params']['id']}},_0x28df30={};_0x28df30[_0x01ca('0x2d')]=_[_0x01ca('0x42')](db[_0x01ca('0x27')][_0x01ca('0x28')]);_0x28df30[_0x01ca('0x2c')]=_[_0x01ca('0x42')](_0x274a90[_0x01ca('0x2c')]);_0x28df30[_0x01ca('0x36')]=_[_0x01ca('0x2f')](_0x28df30[_0x01ca('0x2d')],_0x28df30[_0x01ca('0x2c')]);_0x549f5b[_0x01ca('0x2e')]=_['intersection'](_0x28df30[_0x01ca('0x2d')],qs['fields'](_0x274a90[_0x01ca('0x2c')][_0x01ca('0x30')]));_0x549f5b[_0x01ca('0x2e')]=_0x549f5b[_0x01ca('0x2e')][_0x01ca('0x31')]?_0x549f5b['attributes']:_0x28df30[_0x01ca('0x2d')];if(_0x274a90['query'][_0x01ca('0x3c')]){_0x549f5b[_0x01ca('0x3d')]=[{'all':!![]}];}_0x549f5b=_[_0x01ca('0x3a')]({},_0x549f5b,_0x274a90[_0x01ca('0x3b')]);return db[_0x01ca('0x27')]['find'](_0x549f5b)['then'](handleEntityNotFound(_0x2d20ab,null))['then'](respondWithResult(_0x2d20ab,null))[_0x01ca('0x40')](handleError(_0x2d20ab,null));};exports[_0x01ca('0x43')]=function(_0x235d50,_0x2923a4){return db[_0x01ca('0x27')][_0x01ca('0x43')](_0x235d50[_0x01ca('0x44')],{})[_0x01ca('0x20')](respondWithResult(_0x2923a4,0xc9))[_0x01ca('0x40')](handleError(_0x2923a4,null));};exports[_0x01ca('0x1f')]=function(_0x1ba172,_0x4c09bb){if(_0x1ba172[_0x01ca('0x44')]['id']){delete _0x1ba172[_0x01ca('0x44')]['id'];}return db['ZohoField'][_0x01ca('0x45')]({'where':{'id':_0x1ba172[_0x01ca('0x46')]['id']}})[_0x01ca('0x20')](handleEntityNotFound(_0x4c09bb,null))['then'](saveUpdates(_0x1ba172['body'],null))[_0x01ca('0x20')](respondWithResult(_0x4c09bb,null))['catch'](handleError(_0x4c09bb,null));};exports[_0x01ca('0x21')]=function(_0x351e6e,_0x40f603){return db['ZohoField'][_0x01ca('0x45')]({'where':{'id':_0x351e6e[_0x01ca('0x46')]['id']}})[_0x01ca('0x20')](handleEntityNotFound(_0x40f603,null))[_0x01ca('0x20')](removeEntity(_0x40f603,null))[_0x01ca('0x40')](handleError(_0x40f603,null));};
\ No newline at end of file
+var _0xf977=['ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x370281,_0x50b615){var _0x33a7ae=function(_0x111586){while(--_0x111586){_0x370281['push'](_0x370281['shift']());}};_0x33a7ae(++_0x50b615);}(_0xf977,0x161));var _0x7f97=function(_0x4feb0f,_0x4ea6f5){_0x4feb0f=_0x4feb0f-0x0;var _0x5b50d6=_0xf977[_0x4feb0f];return _0x5b50d6;};'use strict';var pdf=require(_0x7f97('0x0'));var emlformat=require(_0x7f97('0x1'));var rimraf=require(_0x7f97('0x2'));var zipdir=require(_0x7f97('0x3'));var jsonpatch=require(_0x7f97('0x4'));var rp=require(_0x7f97('0x5'));var moment=require(_0x7f97('0x6'));var BPromise=require(_0x7f97('0x7'));var Mustache=require(_0x7f97('0x8'));var util=require(_0x7f97('0x9'));var path=require(_0x7f97('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7f97('0xb'));var squel=require('squel');var crypto=require(_0x7f97('0xc'));var jsforce=require(_0x7f97('0xd'));var deskjs=require(_0x7f97('0xe'));var toCsv=require(_0x7f97('0xf'));var querystring=require(_0x7f97('0x10'));var Papa=require('papaparse');var Redis=require(_0x7f97('0x11'));var authService=require(_0x7f97('0x12'));var qs=require(_0x7f97('0x13'));var as=require(_0x7f97('0x14'));var hardwareService=require(_0x7f97('0x15'));var logger=require('../../config/logger')(_0x7f97('0x16'));var utils=require(_0x7f97('0x17'));var config=require(_0x7f97('0x18'));var licenseUtil=require(_0x7f97('0x19'));var db=require(_0x7f97('0x1a'))['db'];function respondWithStatusCode(_0x58305c,_0x14d25d){_0x14d25d=_0x14d25d||0xcc;return function(_0x20386f){if(_0x20386f){return _0x58305c[_0x7f97('0x1b')](_0x14d25d);}return _0x58305c[_0x7f97('0x1c')](_0x14d25d)[_0x7f97('0x1d')]();};}function respondWithResult(_0x286293,_0x72e7ba){_0x72e7ba=_0x72e7ba||0xc8;return function(_0x854b08){if(_0x854b08){return _0x286293['status'](_0x72e7ba)[_0x7f97('0x1e')](_0x854b08);}};}function respondWithFilteredResult(_0x851c19,_0x101206){return function(_0x1201ee){if(_0x1201ee){var _0x1ebd13=_0x1201ee[_0x7f97('0x1f')],_0x4b8385=_0x101206[_0x7f97('0x20')],_0x588138=_0x101206[_0x7f97('0x20')]+_0x101206['limit'],_0x314c1c;if(_0x588138>=_0x1ebd13){_0x588138=_0x1ebd13;_0x314c1c=0xc8;}else{_0x314c1c=0xce;}_0x851c19['status'](_0x314c1c);return _0x851c19[_0x7f97('0x21')](_0x7f97('0x22'),_0x4b8385+'-'+_0x588138+'/'+_0x1ebd13)[_0x7f97('0x1e')](_0x1201ee);}return null;};}function patchUpdates(_0x107b42){return function(_0x130973){try{jsonpatch[_0x7f97('0x23')](_0x130973,_0x107b42,!![]);}catch(_0x421a6c){return BPromise[_0x7f97('0x24')](_0x421a6c);}return _0x130973[_0x7f97('0x25')]();};}function saveUpdates(_0x37dcac,_0x53e2cc){return function(_0x29d835){if(_0x29d835){return _0x29d835[_0x7f97('0x26')](_0x37dcac)[_0x7f97('0x27')](function(_0x5cc7e6){return _0x5cc7e6;});}return null;};}function removeEntity(_0x1a5f6b,_0x1b645a){return function(_0x282a4c){if(_0x282a4c){return _0x282a4c[_0x7f97('0x28')]()[_0x7f97('0x27')](function(){_0x1a5f6b[_0x7f97('0x1c')](0xcc)[_0x7f97('0x1d')]();});}};}function handleEntityNotFound(_0x594048,_0x223be2){return function(_0x1da87d){if(!_0x1da87d){_0x594048[_0x7f97('0x1b')](0x194);}return _0x1da87d;};}function handleError(_0x470e84,_0x21ec7f){_0x21ec7f=_0x21ec7f||0x1f4;return function(_0x4eade7){logger[_0x7f97('0x29')](_0x4eade7[_0x7f97('0x2a')]);if(_0x4eade7[_0x7f97('0x2b')]){delete _0x4eade7[_0x7f97('0x2b')];}_0x470e84[_0x7f97('0x1c')](_0x21ec7f)[_0x7f97('0x2c')](_0x4eade7);};}exports[_0x7f97('0x2d')]=function(_0xcd942e,_0x21f427){var _0x440fb4={},_0x46f87a={},_0x21a648={'count':0x0,'rows':[]};var _0xea0771=_[_0x7f97('0x2e')](db[_0x7f97('0x2f')][_0x7f97('0x30')],function(_0x1f3d7a){return{'name':_0x1f3d7a[_0x7f97('0x31')],'type':_0x1f3d7a[_0x7f97('0x32')][_0x7f97('0x33')]};});_0x46f87a[_0x7f97('0x34')]=_[_0x7f97('0x2e')](_0xea0771,'name');_0x46f87a[_0x7f97('0x35')]=_[_0x7f97('0x36')](_0xcd942e[_0x7f97('0x35')]);_0x46f87a[_0x7f97('0x37')]=_[_0x7f97('0x38')](_0x46f87a[_0x7f97('0x34')],_0x46f87a['query']);_0x440fb4[_0x7f97('0x39')]=_[_0x7f97('0x38')](_0x46f87a[_0x7f97('0x34')],qs[_0x7f97('0x3a')](_0xcd942e[_0x7f97('0x35')][_0x7f97('0x3a')]));_0x440fb4[_0x7f97('0x39')]=_0x440fb4['attributes'][_0x7f97('0x3b')]?_0x440fb4['attributes']:_0x46f87a[_0x7f97('0x34')];if(!_0xcd942e[_0x7f97('0x35')][_0x7f97('0x3c')]('nolimit')){_0x440fb4[_0x7f97('0x3d')]=qs[_0x7f97('0x3d')](_0xcd942e['query'][_0x7f97('0x3d')]);_0x440fb4[_0x7f97('0x20')]=qs[_0x7f97('0x20')](_0xcd942e[_0x7f97('0x35')][_0x7f97('0x20')]);}_0x440fb4[_0x7f97('0x3e')]=qs[_0x7f97('0x3f')](_0xcd942e[_0x7f97('0x35')][_0x7f97('0x3f')]);_0x440fb4['where']=qs[_0x7f97('0x37')](_[_0x7f97('0x40')](_0xcd942e[_0x7f97('0x35')],_0x46f87a[_0x7f97('0x37')]),_0xea0771);if(_0xcd942e[_0x7f97('0x35')][_0x7f97('0x41')]){_0x440fb4[_0x7f97('0x42')]=_[_0x7f97('0x43')](_0x440fb4[_0x7f97('0x42')],{'$or':_[_0x7f97('0x2e')](_0xea0771,function(_0x3de2c6){if(_0x3de2c6[_0x7f97('0x32')]!==_0x7f97('0x44')){var _0x45a800={};_0x45a800[_0x3de2c6[_0x7f97('0x2b')]]={'$like':'%'+_0xcd942e[_0x7f97('0x35')]['filter']+'%'};return _0x45a800;}})});}_0x440fb4=_['merge']({},_0x440fb4,_0xcd942e['options']);var _0x25047d={'where':_0x440fb4[_0x7f97('0x42')]};return db[_0x7f97('0x2f')][_0x7f97('0x1f')](_0x25047d)[_0x7f97('0x27')](function(_0x25ed32){_0x21a648['count']=_0x25ed32;if(_0xcd942e[_0x7f97('0x35')][_0x7f97('0x45')]){_0x440fb4[_0x7f97('0x46')]=[{'all':!![]}];}return db[_0x7f97('0x2f')][_0x7f97('0x47')](_0x440fb4);})['then'](function(_0x158bc5){_0x21a648[_0x7f97('0x48')]=_0x158bc5;return _0x21a648;})[_0x7f97('0x27')](respondWithFilteredResult(_0x21f427,_0x440fb4))[_0x7f97('0x49')](handleError(_0x21f427,null));};exports[_0x7f97('0x4a')]=function(_0x479844,_0x4a870f){var _0x181d41={'raw':!![],'where':{'id':_0x479844['params']['id']}},_0x219b1a={};_0x219b1a['model']=_[_0x7f97('0x36')](db[_0x7f97('0x2f')][_0x7f97('0x30')]);_0x219b1a[_0x7f97('0x35')]=_[_0x7f97('0x36')](_0x479844[_0x7f97('0x35')]);_0x219b1a[_0x7f97('0x37')]=_[_0x7f97('0x38')](_0x219b1a[_0x7f97('0x34')],_0x219b1a[_0x7f97('0x35')]);_0x181d41[_0x7f97('0x39')]=_['intersection'](_0x219b1a['model'],qs[_0x7f97('0x3a')](_0x479844[_0x7f97('0x35')][_0x7f97('0x3a')]));_0x181d41[_0x7f97('0x39')]=_0x181d41[_0x7f97('0x39')]['length']?_0x181d41[_0x7f97('0x39')]:_0x219b1a[_0x7f97('0x34')];if(_0x479844[_0x7f97('0x35')][_0x7f97('0x45')]){_0x181d41[_0x7f97('0x46')]=[{'all':!![]}];}_0x181d41=_[_0x7f97('0x43')]({},_0x181d41,_0x479844[_0x7f97('0x4b')]);return db[_0x7f97('0x2f')][_0x7f97('0x4c')](_0x181d41)[_0x7f97('0x27')](handleEntityNotFound(_0x4a870f,null))[_0x7f97('0x27')](respondWithResult(_0x4a870f,null))['catch'](handleError(_0x4a870f,null));};exports[_0x7f97('0x4d')]=function(_0x5f1fb6,_0x56a2db){return db[_0x7f97('0x2f')][_0x7f97('0x4d')](_0x5f1fb6[_0x7f97('0x4e')],{})[_0x7f97('0x27')](respondWithResult(_0x56a2db,0xc9))[_0x7f97('0x49')](handleError(_0x56a2db,null));};exports['update']=function(_0x4d41ca,_0x3d365f){if(_0x4d41ca[_0x7f97('0x4e')]['id']){delete _0x4d41ca['body']['id'];}return db['ZohoField'][_0x7f97('0x4c')]({'where':{'id':_0x4d41ca[_0x7f97('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3d365f,null))[_0x7f97('0x27')](saveUpdates(_0x4d41ca['body'],null))['then'](respondWithResult(_0x3d365f,null))[_0x7f97('0x49')](handleError(_0x3d365f,null));};exports['destroy']=function(_0x4f9fe5,_0x326f1e){return db[_0x7f97('0x2f')][_0x7f97('0x4c')]({'where':{'id':_0x4f9fe5['params']['id']}})['then'](handleEntityNotFound(_0x326f1e,null))[_0x7f97('0x27')](removeEntity(_0x326f1e,null))[_0x7f97('0x49')](handleError(_0x326f1e,null));};
\ No newline at end of file