Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / api / intZohoField / intZohoField.controller.js
index 8b56a0b..66fa9d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f8b=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','ZohoField','rawAttributes','type','key','model','query','keys'];(function(_0x121737,_0x329846){var _0x2e6722=function(_0x3eed79){while(--_0x3eed79){_0x121737['push'](_0x121737['shift']());}};_0x2e6722(++_0x329846);}(_0x6f8b,0x1cb));var _0xb6f8=function(_0x14c308,_0x5689d6){_0x14c308=_0x14c308-0x0;var _0x267a4a=_0x6f8b[_0x14c308];return _0x267a4a;};'use strict';var pdf=require(_0xb6f8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb6f8('0x1'));var jsonpatch=require(_0xb6f8('0x2'));var rp=require(_0xb6f8('0x3'));var moment=require(_0xb6f8('0x4'));var BPromise=require(_0xb6f8('0x5'));var Mustache=require(_0xb6f8('0x6'));var util=require(_0xb6f8('0x7'));var path=require('path');var sox=require(_0xb6f8('0x8'));var csv=require(_0xb6f8('0x9'));var ejs=require(_0xb6f8('0xa'));var fs=require('fs');var _=require(_0xb6f8('0xb'));var squel=require(_0xb6f8('0xc'));var crypto=require(_0xb6f8('0xd'));var jsforce=require(_0xb6f8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb6f8('0xf'));var Papa=require(_0xb6f8('0x10'));var Redis=require(_0xb6f8('0x11'));var authService=require(_0xb6f8('0x12'));var qs=require(_0xb6f8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6f8('0x14'));var logger=require(_0xb6f8('0x15'))(_0xb6f8('0x16'));var utils=require(_0xb6f8('0x17'));var config=require(_0xb6f8('0x18'));var licenseUtil=require(_0xb6f8('0x19'));var db=require(_0xb6f8('0x1a'))['db'];function respondWithStatusCode(_0x4f17a5,_0x205ac6){_0x205ac6=_0x205ac6||0xcc;return function(_0x329384){if(_0x329384){return _0x4f17a5[_0xb6f8('0x1b')](_0x205ac6);}return _0x4f17a5[_0xb6f8('0x1c')](_0x205ac6)[_0xb6f8('0x1d')]();};}function respondWithResult(_0x592b5f,_0x538093){_0x538093=_0x538093||0xc8;return function(_0x39f2da){if(_0x39f2da){return _0x592b5f[_0xb6f8('0x1c')](_0x538093)[_0xb6f8('0x1e')](_0x39f2da);}};}function respondWithFilteredResult(_0x1ac96f,_0x2b9501){return function(_0x45626e){if(_0x45626e){var _0x2c6d84=_0x45626e[_0xb6f8('0x1f')],_0x931274=_0x2b9501[_0xb6f8('0x20')],_0x20f09c=_0x2b9501[_0xb6f8('0x20')]+_0x2b9501[_0xb6f8('0x21')],_0xb50745;if(_0x20f09c>=_0x2c6d84){_0x20f09c=_0x2c6d84;_0xb50745=0xc8;}else{_0xb50745=0xce;}_0x1ac96f[_0xb6f8('0x1c')](_0xb50745);return _0x1ac96f[_0xb6f8('0x22')](_0xb6f8('0x23'),_0x931274+'-'+_0x20f09c+'/'+_0x2c6d84)[_0xb6f8('0x1e')](_0x45626e);}return null;};}function patchUpdates(_0x4e5688){return function(_0x239c82){try{jsonpatch[_0xb6f8('0x24')](_0x239c82,_0x4e5688,!![]);}catch(_0x459b0f){return BPromise['reject'](_0x459b0f);}return _0x239c82[_0xb6f8('0x25')]();};}function saveUpdates(_0x582e01,_0x1f2656){return function(_0x400af0){if(_0x400af0){return _0x400af0[_0xb6f8('0x26')](_0x582e01)[_0xb6f8('0x27')](function(_0xe8c04d){return _0xe8c04d;});}return null;};}function removeEntity(_0x1dc746,_0x5f1309){return function(_0x274bc9){if(_0x274bc9){return _0x274bc9[_0xb6f8('0x28')]()[_0xb6f8('0x27')](function(){_0x1dc746[_0xb6f8('0x1c')](0xcc)[_0xb6f8('0x1d')]();});}};}function handleEntityNotFound(_0x369ca1,_0x552ec9){return function(_0x21e1a8){if(!_0x21e1a8){_0x369ca1['sendStatus'](0x194);}return _0x21e1a8;};}function handleError(_0x42c0ee,_0x1654f5){_0x1654f5=_0x1654f5||0x1f4;return function(_0x3ebf2b){logger['error'](_0x3ebf2b['stack']);if(_0x3ebf2b[_0xb6f8('0x29')]){delete _0x3ebf2b['name'];}_0x42c0ee[_0xb6f8('0x1c')](_0x1654f5)[_0xb6f8('0x2a')](_0x3ebf2b);};}exports[_0xb6f8('0x2b')]=function(_0x499f43,_0x2e2af5){var _0xc57d85={},_0x3d0fb0={},_0xa61b69={'count':0x0,'rows':[]};var _0x46e869=_[_0xb6f8('0x2c')](db[_0xb6f8('0x2d')][_0xb6f8('0x2e')],function(_0x98602c){return{'name':_0x98602c['fieldName'],'type':_0x98602c[_0xb6f8('0x2f')][_0xb6f8('0x30')]};});_0x3d0fb0[_0xb6f8('0x31')]=_['map'](_0x46e869,_0xb6f8('0x29'));_0x3d0fb0[_0xb6f8('0x32')]=_[_0xb6f8('0x33')](_0x499f43[_0xb6f8('0x32')]);_0x3d0fb0[_0xb6f8('0x34')]=_[_0xb6f8('0x35')](_0x3d0fb0['model'],_0x3d0fb0[_0xb6f8('0x32')]);_0xc57d85[_0xb6f8('0x36')]=_[_0xb6f8('0x35')](_0x3d0fb0[_0xb6f8('0x31')],qs[_0xb6f8('0x37')](_0x499f43[_0xb6f8('0x32')]['fields']));_0xc57d85[_0xb6f8('0x36')]=_0xc57d85['attributes'][_0xb6f8('0x38')]?_0xc57d85[_0xb6f8('0x36')]:_0x3d0fb0[_0xb6f8('0x31')];if(!_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x39')]('nolimit')){_0xc57d85[_0xb6f8('0x21')]=qs['limit'](_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x21')]);_0xc57d85[_0xb6f8('0x20')]=qs[_0xb6f8('0x20')](_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x20')]);}_0xc57d85[_0xb6f8('0x3a')]=qs[_0xb6f8('0x3b')](_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x3b')]);_0xc57d85[_0xb6f8('0x3c')]=qs[_0xb6f8('0x34')](_['pick'](_0x499f43[_0xb6f8('0x32')],_0x3d0fb0[_0xb6f8('0x34')]),_0x46e869);if(_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x3d')]){_0xc57d85['where']=_[_0xb6f8('0x3e')](_0xc57d85['where'],{'$or':_[_0xb6f8('0x2c')](_0x46e869,function(_0x11648f){if(_0x11648f[_0xb6f8('0x2f')]!==_0xb6f8('0x3f')){var _0x1fdd27={};_0x1fdd27[_0x11648f[_0xb6f8('0x29')]]={'$like':'%'+_0x499f43['query'][_0xb6f8('0x3d')]+'%'};return _0x1fdd27;}})});}_0xc57d85=_[_0xb6f8('0x3e')]({},_0xc57d85,_0x499f43['options']);var _0x51d1c7={'where':_0xc57d85[_0xb6f8('0x3c')]};return db['ZohoField']['count'](_0x51d1c7)[_0xb6f8('0x27')](function(_0x5c97fa){_0xa61b69[_0xb6f8('0x1f')]=_0x5c97fa;if(_0x499f43[_0xb6f8('0x32')][_0xb6f8('0x40')]){_0xc57d85[_0xb6f8('0x41')]=[{'all':!![]}];}return db[_0xb6f8('0x2d')][_0xb6f8('0x42')](_0xc57d85);})[_0xb6f8('0x27')](function(_0x38c9a1){_0xa61b69[_0xb6f8('0x43')]=_0x38c9a1;return _0xa61b69;})[_0xb6f8('0x27')](respondWithFilteredResult(_0x2e2af5,_0xc57d85))[_0xb6f8('0x44')](handleError(_0x2e2af5,null));};exports['show']=function(_0x4935c1,_0x26af61){var _0x175b80={'raw':!![],'where':{'id':_0x4935c1[_0xb6f8('0x45')]['id']}},_0x5451c0={};_0x5451c0[_0xb6f8('0x31')]=_[_0xb6f8('0x33')](db[_0xb6f8('0x2d')][_0xb6f8('0x2e')]);_0x5451c0[_0xb6f8('0x32')]=_[_0xb6f8('0x33')](_0x4935c1[_0xb6f8('0x32')]);_0x5451c0[_0xb6f8('0x34')]=_[_0xb6f8('0x35')](_0x5451c0[_0xb6f8('0x31')],_0x5451c0[_0xb6f8('0x32')]);_0x175b80[_0xb6f8('0x36')]=_[_0xb6f8('0x35')](_0x5451c0[_0xb6f8('0x31')],qs[_0xb6f8('0x37')](_0x4935c1['query']['fields']));_0x175b80['attributes']=_0x175b80[_0xb6f8('0x36')]['length']?_0x175b80[_0xb6f8('0x36')]:_0x5451c0[_0xb6f8('0x31')];if(_0x4935c1[_0xb6f8('0x32')][_0xb6f8('0x40')]){_0x175b80['include']=[{'all':!![]}];}_0x175b80=_[_0xb6f8('0x3e')]({},_0x175b80,_0x4935c1['options']);return db[_0xb6f8('0x2d')][_0xb6f8('0x46')](_0x175b80)['then'](handleEntityNotFound(_0x26af61,null))[_0xb6f8('0x27')](respondWithResult(_0x26af61,null))['catch'](handleError(_0x26af61,null));};exports['create']=function(_0xf73d70,_0x3a52b2){return db[_0xb6f8('0x2d')][_0xb6f8('0x47')](_0xf73d70[_0xb6f8('0x48')],{})[_0xb6f8('0x27')](respondWithResult(_0x3a52b2,0xc9))[_0xb6f8('0x44')](handleError(_0x3a52b2,null));};exports['update']=function(_0x2b70d3,_0x278365){if(_0x2b70d3['body']['id']){delete _0x2b70d3[_0xb6f8('0x48')]['id'];}return db[_0xb6f8('0x2d')][_0xb6f8('0x46')]({'where':{'id':_0x2b70d3[_0xb6f8('0x45')]['id']}})[_0xb6f8('0x27')](handleEntityNotFound(_0x278365,null))[_0xb6f8('0x27')](saveUpdates(_0x2b70d3[_0xb6f8('0x48')],null))[_0xb6f8('0x27')](respondWithResult(_0x278365,null))[_0xb6f8('0x44')](handleError(_0x278365,null));};exports[_0xb6f8('0x28')]=function(_0x51b42d,_0x64fda1){return db[_0xb6f8('0x2d')][_0xb6f8('0x46')]({'where':{'id':_0x51b42d[_0xb6f8('0x45')]['id']}})[_0xb6f8('0x27')](handleEntityNotFound(_0x64fda1,null))[_0xb6f8('0x27')](removeEntity(_0x64fda1,null))[_0xb6f8('0x44')](handleError(_0x64fda1,null));};
\ No newline at end of file
+var _0x4460=['update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','stack','name','send','index','map','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','ZohoField','includeAll','show','params','keys','rawAttributes','include','find','catch','create','body'];(function(_0x12ae9,_0x3d8aa6){var _0x4cebb2=function(_0x564132){while(--_0x564132){_0x12ae9['push'](_0x12ae9['shift']());}};_0x4cebb2(++_0x3d8aa6);}(_0x4460,0x97));var _0x0446=function(_0x217c86,_0x97c004){_0x217c86=_0x217c86-0x0;var _0x32284d=_0x4460[_0x217c86];return _0x32284d;};'use strict';var pdf=require(_0x0446('0x0'));var emlformat=require(_0x0446('0x1'));var rimraf=require(_0x0446('0x2'));var zipdir=require(_0x0446('0x3'));var jsonpatch=require(_0x0446('0x4'));var rp=require(_0x0446('0x5'));var moment=require(_0x0446('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0446('0x7'));var util=require(_0x0446('0x8'));var path=require(_0x0446('0x9'));var sox=require(_0x0446('0xa'));var csv=require(_0x0446('0xb'));var ejs=require(_0x0446('0xc'));var fs=require('fs');var _=require(_0x0446('0xd'));var squel=require('squel');var crypto=require(_0x0446('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0446('0xf'));var toCsv=require(_0x0446('0xb'));var querystring=require(_0x0446('0x10'));var Papa=require('papaparse');var Redis=require(_0x0446('0x11'));var authService=require(_0x0446('0x12'));var qs=require(_0x0446('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0446('0x14'));var logger=require(_0x0446('0x15'))(_0x0446('0x16'));var utils=require(_0x0446('0x17'));var config=require(_0x0446('0x18'));var licenseUtil=require(_0x0446('0x19'));var db=require(_0x0446('0x1a'))['db'];function respondWithStatusCode(_0x11411c,_0x54a5f2){_0x54a5f2=_0x54a5f2||0xcc;return function(_0xd22be3){if(_0xd22be3){return _0x11411c[_0x0446('0x1b')](_0x54a5f2);}return _0x11411c[_0x0446('0x1c')](_0x54a5f2)[_0x0446('0x1d')]();};}function respondWithResult(_0x5a9fa5,_0x41e35d){_0x41e35d=_0x41e35d||0xc8;return function(_0x58f453){if(_0x58f453){return _0x5a9fa5[_0x0446('0x1c')](_0x41e35d)[_0x0446('0x1e')](_0x58f453);}};}function respondWithFilteredResult(_0x2d0173,_0x331141){return function(_0x4976bc){if(_0x4976bc){var _0x38e268=_0x4976bc[_0x0446('0x1f')],_0x437377=_0x331141[_0x0446('0x20')],_0x55423d=_0x331141['offset']+_0x331141[_0x0446('0x21')],_0x27ab42;if(_0x55423d>=_0x38e268){_0x55423d=_0x38e268;_0x27ab42=0xc8;}else{_0x27ab42=0xce;}_0x2d0173[_0x0446('0x1c')](_0x27ab42);return _0x2d0173[_0x0446('0x22')](_0x0446('0x23'),_0x437377+'-'+_0x55423d+'/'+_0x38e268)[_0x0446('0x1e')](_0x4976bc);}return null;};}function patchUpdates(_0x608479){return function(_0x3f989c){try{jsonpatch['apply'](_0x3f989c,_0x608479,!![]);}catch(_0xd646c0){return BPromise[_0x0446('0x24')](_0xd646c0);}return _0x3f989c[_0x0446('0x25')]();};}function saveUpdates(_0x3656ae,_0x3a1161){return function(_0x148533){if(_0x148533){return _0x148533['update'](_0x3656ae)['then'](function(_0x5ddfab){return _0x5ddfab;});}return null;};}function removeEntity(_0x1d74ad,_0x533e3a){return function(_0x5535f9){if(_0x5535f9){return _0x5535f9[_0x0446('0x26')]()[_0x0446('0x27')](function(){_0x1d74ad[_0x0446('0x1c')](0xcc)[_0x0446('0x1d')]();});}};}function handleEntityNotFound(_0xefeae2,_0x5d9a6b){return function(_0x223acc){if(!_0x223acc){_0xefeae2[_0x0446('0x1b')](0x194);}return _0x223acc;};}function handleError(_0x243a8d,_0xe7251b){_0xe7251b=_0xe7251b||0x1f4;return function(_0x35cc40){logger['error'](_0x35cc40[_0x0446('0x28')]);if(_0x35cc40[_0x0446('0x29')]){delete _0x35cc40[_0x0446('0x29')];}_0x243a8d[_0x0446('0x1c')](_0xe7251b)[_0x0446('0x2a')](_0x35cc40);};}exports[_0x0446('0x2b')]=function(_0x1dc96d,_0x194c23){var _0x3c8f83={},_0x2d36fd={},_0xf9d619={'count':0x0,'rows':[]};var _0x2618c5=_[_0x0446('0x2c')](db['ZohoField']['rawAttributes'],function(_0x46027a){return{'name':_0x46027a[_0x0446('0x2d')],'type':_0x46027a[_0x0446('0x2e')][_0x0446('0x2f')]};});_0x2d36fd[_0x0446('0x30')]=_[_0x0446('0x2c')](_0x2618c5,_0x0446('0x29'));_0x2d36fd['query']=_['keys'](_0x1dc96d[_0x0446('0x31')]);_0x2d36fd['filters']=_['intersection'](_0x2d36fd[_0x0446('0x30')],_0x2d36fd[_0x0446('0x31')]);_0x3c8f83[_0x0446('0x32')]=_[_0x0446('0x33')](_0x2d36fd[_0x0446('0x30')],qs[_0x0446('0x34')](_0x1dc96d[_0x0446('0x31')]['fields']));_0x3c8f83['attributes']=_0x3c8f83['attributes'][_0x0446('0x35')]?_0x3c8f83[_0x0446('0x32')]:_0x2d36fd[_0x0446('0x30')];if(!_0x1dc96d['query'][_0x0446('0x36')]('nolimit')){_0x3c8f83[_0x0446('0x21')]=qs['limit'](_0x1dc96d[_0x0446('0x31')][_0x0446('0x21')]);_0x3c8f83[_0x0446('0x20')]=qs[_0x0446('0x20')](_0x1dc96d[_0x0446('0x31')][_0x0446('0x20')]);}_0x3c8f83[_0x0446('0x37')]=qs[_0x0446('0x38')](_0x1dc96d[_0x0446('0x31')][_0x0446('0x38')]);_0x3c8f83['where']=qs[_0x0446('0x39')](_['pick'](_0x1dc96d[_0x0446('0x31')],_0x2d36fd[_0x0446('0x39')]),_0x2618c5);if(_0x1dc96d[_0x0446('0x31')][_0x0446('0x3a')]){_0x3c8f83[_0x0446('0x3b')]=_[_0x0446('0x3c')](_0x3c8f83[_0x0446('0x3b')],{'$or':_[_0x0446('0x2c')](_0x2618c5,function(_0x5a717d){if(_0x5a717d['type']!==_0x0446('0x3d')){var _0x37211e={};_0x37211e[_0x5a717d[_0x0446('0x29')]]={'$like':'%'+_0x1dc96d['query']['filter']+'%'};return _0x37211e;}})});}_0x3c8f83=_[_0x0446('0x3c')]({},_0x3c8f83,_0x1dc96d[_0x0446('0x3e')]);var _0x14d438={'where':_0x3c8f83['where']};return db[_0x0446('0x3f')]['count'](_0x14d438)['then'](function(_0x524b16){_0xf9d619[_0x0446('0x1f')]=_0x524b16;if(_0x1dc96d[_0x0446('0x31')][_0x0446('0x40')]){_0x3c8f83['include']=[{'all':!![]}];}return db[_0x0446('0x3f')]['findAll'](_0x3c8f83);})[_0x0446('0x27')](function(_0xbae86d){_0xf9d619['rows']=_0xbae86d;return _0xf9d619;})[_0x0446('0x27')](respondWithFilteredResult(_0x194c23,_0x3c8f83))['catch'](handleError(_0x194c23,null));};exports[_0x0446('0x41')]=function(_0x2feab3,_0x30314e){var _0x2ec584={'raw':!![],'where':{'id':_0x2feab3[_0x0446('0x42')]['id']}},_0x21e440={};_0x21e440[_0x0446('0x30')]=_[_0x0446('0x43')](db[_0x0446('0x3f')][_0x0446('0x44')]);_0x21e440['query']=_[_0x0446('0x43')](_0x2feab3[_0x0446('0x31')]);_0x21e440[_0x0446('0x39')]=_['intersection'](_0x21e440[_0x0446('0x30')],_0x21e440[_0x0446('0x31')]);_0x2ec584[_0x0446('0x32')]=_['intersection'](_0x21e440[_0x0446('0x30')],qs[_0x0446('0x34')](_0x2feab3[_0x0446('0x31')]['fields']));_0x2ec584[_0x0446('0x32')]=_0x2ec584[_0x0446('0x32')][_0x0446('0x35')]?_0x2ec584[_0x0446('0x32')]:_0x21e440['model'];if(_0x2feab3[_0x0446('0x31')][_0x0446('0x40')]){_0x2ec584[_0x0446('0x45')]=[{'all':!![]}];}_0x2ec584=_[_0x0446('0x3c')]({},_0x2ec584,_0x2feab3[_0x0446('0x3e')]);return db['ZohoField'][_0x0446('0x46')](_0x2ec584)[_0x0446('0x27')](handleEntityNotFound(_0x30314e,null))[_0x0446('0x27')](respondWithResult(_0x30314e,null))[_0x0446('0x47')](handleError(_0x30314e,null));};exports[_0x0446('0x48')]=function(_0x2e51e7,_0x574625){return db[_0x0446('0x3f')]['create'](_0x2e51e7[_0x0446('0x49')],{})['then'](respondWithResult(_0x574625,0xc9))[_0x0446('0x47')](handleError(_0x574625,null));};exports[_0x0446('0x4a')]=function(_0x478757,_0x1c6184){if(_0x478757['body']['id']){delete _0x478757['body']['id'];}return db[_0x0446('0x3f')][_0x0446('0x46')]({'where':{'id':_0x478757[_0x0446('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c6184,null))[_0x0446('0x27')](saveUpdates(_0x478757[_0x0446('0x49')],null))[_0x0446('0x27')](respondWithResult(_0x1c6184,null))[_0x0446('0x47')](handleError(_0x1c6184,null));};exports['destroy']=function(_0x51c0a4,_0x413d14){return db[_0x0446('0x3f')][_0x0446('0x46')]({'where':{'id':_0x51c0a4[_0x0446('0x42')]['id']}})['then'](handleEntityNotFound(_0x413d14,null))['then'](removeEntity(_0x413d14,null))['catch'](handleError(_0x413d14,null));};
\ No newline at end of file