Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / api / intSalesforceField / intSalesforceField.controller.js
index 68a18ed..9eaff72 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1548=['length','includeAll','include','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','params'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1548,0x1c2));var _0x8154=function(_0x20c8ef,_0x77211a){_0x20c8ef=_0x20c8ef-0x0;var _0x4de872=_0x1548[_0x20c8ef];return _0x4de872;};'use strict';var pdf=require(_0x8154('0x0'));var emlformat=require(_0x8154('0x1'));var rimraf=require(_0x8154('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8154('0x3'));var rp=require(_0x8154('0x4'));var moment=require(_0x8154('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8154('0x6'));var util=require(_0x8154('0x7'));var path=require(_0x8154('0x8'));var sox=require('sox');var csv=require(_0x8154('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8154('0xa'));var squel=require(_0x8154('0xb'));var crypto=require(_0x8154('0xc'));var jsforce=require(_0x8154('0xd'));var deskjs=require(_0x8154('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8154('0xf'));var Papa=require(_0x8154('0x10'));var Redis=require('ioredis');var authService=require(_0x8154('0x11'));var qs=require(_0x8154('0x12'));var as=require(_0x8154('0x13'));var hardwareService=require(_0x8154('0x14'));var logger=require(_0x8154('0x15'))(_0x8154('0x16'));var utils=require(_0x8154('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53d7f4,_0x1d1423){_0x1d1423=_0x1d1423||0xcc;return function(_0x29b886){if(_0x29b886){return _0x53d7f4[_0x8154('0x18')](_0x1d1423);}return _0x53d7f4[_0x8154('0x19')](_0x1d1423)[_0x8154('0x1a')]();};}function respondWithResult(_0x35a5d1,_0x44d13d){_0x44d13d=_0x44d13d||0xc8;return function(_0x204c0e){if(_0x204c0e){return _0x35a5d1[_0x8154('0x19')](_0x44d13d)[_0x8154('0x1b')](_0x204c0e);}};}function respondWithFilteredResult(_0x26657b,_0x426202){return function(_0x28d83e){if(_0x28d83e){var _0xc06026=_0x28d83e[_0x8154('0x1c')],_0x255f0d=_0x426202[_0x8154('0x1d')],_0x1bbacd=_0x426202[_0x8154('0x1d')]+_0x426202[_0x8154('0x1e')],_0x3feb80;if(_0x1bbacd>=_0xc06026){_0x1bbacd=_0xc06026;_0x3feb80=0xc8;}else{_0x3feb80=0xce;}_0x26657b[_0x8154('0x19')](_0x3feb80);return _0x26657b[_0x8154('0x1f')](_0x8154('0x20'),_0x255f0d+'-'+_0x1bbacd+'/'+_0xc06026)['json'](_0x28d83e);}return null;};}function patchUpdates(_0x20da73){return function(_0x40bc5d){try{jsonpatch[_0x8154('0x21')](_0x40bc5d,_0x20da73,!![]);}catch(_0x14b1a6){return BPromise[_0x8154('0x22')](_0x14b1a6);}return _0x40bc5d[_0x8154('0x23')]();};}function saveUpdates(_0x58a418,_0x5415b7){return function(_0x434dbf){if(_0x434dbf){return _0x434dbf['update'](_0x58a418)[_0x8154('0x24')](function(_0xf677ea){return _0xf677ea;});}return null;};}function removeEntity(_0x941ca1,_0x11428f){return function(_0x6bfce0){if(_0x6bfce0){return _0x6bfce0[_0x8154('0x25')]()['then'](function(){_0x941ca1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x406f89,_0x1655ff){return function(_0x58bf9f){if(!_0x58bf9f){_0x406f89[_0x8154('0x18')](0x194);}return _0x58bf9f;};}function handleError(_0x3c6fee,_0x15d072){_0x15d072=_0x15d072||0x1f4;return function(_0x4b6832){logger[_0x8154('0x26')](_0x4b6832[_0x8154('0x27')]);if(_0x4b6832[_0x8154('0x28')]){delete _0x4b6832[_0x8154('0x28')];}_0x3c6fee[_0x8154('0x19')](_0x15d072)[_0x8154('0x29')](_0x4b6832);};}exports[_0x8154('0x2a')]=function(_0x316628,_0xd70a42){var _0x2f2247={},_0x51af02={},_0x59dcbd={'count':0x0,'rows':[]};var _0xc18c3d=_[_0x8154('0x2b')](db[_0x8154('0x2c')][_0x8154('0x2d')],function(_0x5a6d1f){return{'name':_0x5a6d1f[_0x8154('0x2e')],'type':_0x5a6d1f['type']['key']};});_0x51af02[_0x8154('0x2f')]=_[_0x8154('0x2b')](_0xc18c3d,_0x8154('0x28'));_0x51af02[_0x8154('0x30')]=_[_0x8154('0x31')](_0x316628[_0x8154('0x30')]);_0x51af02['filters']=_[_0x8154('0x32')](_0x51af02[_0x8154('0x2f')],_0x51af02[_0x8154('0x30')]);_0x2f2247['attributes']=_[_0x8154('0x32')](_0x51af02['model'],qs[_0x8154('0x33')](_0x316628[_0x8154('0x30')][_0x8154('0x33')]));_0x2f2247[_0x8154('0x34')]=_0x2f2247['attributes']['length']?_0x2f2247['attributes']:_0x51af02[_0x8154('0x2f')];if(!_0x316628[_0x8154('0x30')]['hasOwnProperty'](_0x8154('0x35'))){_0x2f2247[_0x8154('0x1e')]=qs[_0x8154('0x1e')](_0x316628[_0x8154('0x30')][_0x8154('0x1e')]);_0x2f2247[_0x8154('0x1d')]=qs['offset'](_0x316628['query']['offset']);}_0x2f2247[_0x8154('0x36')]=qs[_0x8154('0x37')](_0x316628['query'][_0x8154('0x37')]);_0x2f2247['where']=qs[_0x8154('0x38')](_[_0x8154('0x39')](_0x316628[_0x8154('0x30')],_0x51af02[_0x8154('0x38')]),_0xc18c3d);if(_0x316628[_0x8154('0x30')][_0x8154('0x3a')]){_0x2f2247[_0x8154('0x3b')]=_['merge'](_0x2f2247[_0x8154('0x3b')],{'$or':_[_0x8154('0x2b')](_0xc18c3d,function(_0x507561){if(_0x507561['type']!==_0x8154('0x3c')){var _0x24d7ee={};_0x24d7ee[_0x507561[_0x8154('0x28')]]={'$like':'%'+_0x316628[_0x8154('0x30')][_0x8154('0x3a')]+'%'};return _0x24d7ee;}})});}_0x2f2247=_[_0x8154('0x3d')]({},_0x2f2247,_0x316628[_0x8154('0x3e')]);var _0x37ad29={'where':_0x2f2247[_0x8154('0x3b')]};return db[_0x8154('0x2c')][_0x8154('0x1c')](_0x37ad29)[_0x8154('0x24')](function(_0x46fdb4){_0x59dcbd[_0x8154('0x1c')]=_0x46fdb4;if(_0x316628[_0x8154('0x30')]['includeAll']){_0x2f2247['include']=[{'all':!![]}];}return db[_0x8154('0x2c')][_0x8154('0x3f')](_0x2f2247);})[_0x8154('0x24')](function(_0x29da41){_0x59dcbd[_0x8154('0x40')]=_0x29da41;return _0x59dcbd;})[_0x8154('0x24')](respondWithFilteredResult(_0xd70a42,_0x2f2247))[_0x8154('0x41')](handleError(_0xd70a42,null));};exports[_0x8154('0x42')]=function(_0x294984,_0x191e9b){var _0x4a4c8e={'raw':!![],'where':{'id':_0x294984[_0x8154('0x43')]['id']}},_0x1e3dc0={};_0x1e3dc0[_0x8154('0x2f')]=_['keys'](db['SalesforceField'][_0x8154('0x2d')]);_0x1e3dc0[_0x8154('0x30')]=_[_0x8154('0x31')](_0x294984['query']);_0x1e3dc0[_0x8154('0x38')]=_[_0x8154('0x32')](_0x1e3dc0[_0x8154('0x2f')],_0x1e3dc0[_0x8154('0x30')]);_0x4a4c8e[_0x8154('0x34')]=_[_0x8154('0x32')](_0x1e3dc0[_0x8154('0x2f')],qs[_0x8154('0x33')](_0x294984[_0x8154('0x30')]['fields']));_0x4a4c8e[_0x8154('0x34')]=_0x4a4c8e['attributes'][_0x8154('0x44')]?_0x4a4c8e[_0x8154('0x34')]:_0x1e3dc0[_0x8154('0x2f')];if(_0x294984[_0x8154('0x30')][_0x8154('0x45')]){_0x4a4c8e[_0x8154('0x46')]=[{'all':!![]}];}_0x4a4c8e=_[_0x8154('0x3d')]({},_0x4a4c8e,_0x294984[_0x8154('0x3e')]);return db[_0x8154('0x2c')]['find'](_0x4a4c8e)[_0x8154('0x24')](handleEntityNotFound(_0x191e9b,null))[_0x8154('0x24')](respondWithResult(_0x191e9b,null))[_0x8154('0x41')](handleError(_0x191e9b,null));};exports[_0x8154('0x47')]=function(_0x5a4b27,_0x3f4f3e){return db[_0x8154('0x2c')]['create'](_0x5a4b27[_0x8154('0x48')],{})['then'](respondWithResult(_0x3f4f3e,0xc9))['catch'](handleError(_0x3f4f3e,null));};exports['update']=function(_0x2d79e1,_0x2676da){if(_0x2d79e1[_0x8154('0x48')]['id']){delete _0x2d79e1[_0x8154('0x48')]['id'];}return db[_0x8154('0x2c')]['find']({'where':{'id':_0x2d79e1[_0x8154('0x43')]['id']}})[_0x8154('0x24')](handleEntityNotFound(_0x2676da,null))['then'](saveUpdates(_0x2d79e1[_0x8154('0x48')],null))[_0x8154('0x24')](respondWithResult(_0x2676da,null))[_0x8154('0x41')](handleError(_0x2676da,null));};exports[_0x8154('0x25')]=function(_0x5f5224,_0x271f87){return db['SalesforceField'][_0x8154('0x49')]({'where':{'id':_0x5f5224['params']['id']}})[_0x8154('0x24')](handleEntityNotFound(_0x271f87,null))[_0x8154('0x24')](removeEntity(_0x271f87,null))[_0x8154('0x41')](handleError(_0x271f87,null));};
\ No newline at end of file
+var _0x5418=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x50a13f,_0x5a2a04){var _0x3e7e6f=function(_0x55a5be){while(--_0x55a5be){_0x50a13f['push'](_0x50a13f['shift']());}};_0x3e7e6f(++_0x5a2a04);}(_0x5418,0x7e));var _0x8541=function(_0x2f0daa,_0x34c4ec){_0x2f0daa=_0x2f0daa-0x0;var _0x109070=_0x5418[_0x2f0daa];return _0x109070;};'use strict';var emlformat=require(_0x8541('0x0'));var rimraf=require(_0x8541('0x1'));var zipdir=require(_0x8541('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8541('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8541('0x4'));var util=require(_0x8541('0x5'));var path=require('path');var sox=require(_0x8541('0x6'));var csv=require('to-csv');var ejs=require(_0x8541('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8541('0x8'));var squel=require(_0x8541('0x9'));var crypto=require('crypto');var jsforce=require(_0x8541('0xa'));var deskjs=require(_0x8541('0xb'));var toCsv=require(_0x8541('0xc'));var querystring=require(_0x8541('0xd'));var Papa=require(_0x8541('0xe'));var Redis=require('ioredis');var authService=require(_0x8541('0xf'));var qs=require(_0x8541('0x10'));var as=require(_0x8541('0x11'));var hardwareService=require(_0x8541('0x12'));var logger=require(_0x8541('0x13'))(_0x8541('0x14'));var utils=require(_0x8541('0x15'));var config=require(_0x8541('0x16'));var licenseUtil=require(_0x8541('0x17'));var db=require(_0x8541('0x18'))['db'];function respondWithStatusCode(_0x2cad6c,_0x4c5909){_0x4c5909=_0x4c5909||0xcc;return function(_0xd2ef5b){if(_0xd2ef5b){return _0x2cad6c['sendStatus'](_0x4c5909);}return _0x2cad6c[_0x8541('0x19')](_0x4c5909)[_0x8541('0x1a')]();};}function respondWithResult(_0x20ee40,_0x20c2aa){_0x20c2aa=_0x20c2aa||0xc8;return function(_0x476db8){if(_0x476db8){return _0x20ee40[_0x8541('0x19')](_0x20c2aa)[_0x8541('0x1b')](_0x476db8);}};}function respondWithFilteredResult(_0x43630e,_0x2a0744){return function(_0x2fc893){if(_0x2fc893){var _0x36a27d=typeof _0x2a0744[_0x8541('0x1c')]==='undefined'&&typeof _0x2a0744[_0x8541('0x1d')]==='undefined';var _0x4f8161=_0x2fc893[_0x8541('0x1e')];var _0x4fcede=_0x36a27d?0x0:_0x2a0744[_0x8541('0x1c')];var _0x51d616=_0x36a27d?_0x2fc893[_0x8541('0x1e')]:_0x2a0744['offset']+_0x2a0744['limit'];var _0x454d19;if(_0x51d616>=_0x4f8161){_0x51d616=_0x4f8161;_0x454d19=0xc8;}else{_0x454d19=0xce;}_0x43630e[_0x8541('0x19')](_0x454d19);return _0x43630e['set'](_0x8541('0x1f'),_0x4fcede+'-'+_0x51d616+'/'+_0x4f8161)[_0x8541('0x1b')](_0x2fc893);}return null;};}function patchUpdates(_0x3d2b2d){return function(_0x594d08){try{jsonpatch['apply'](_0x594d08,_0x3d2b2d,!![]);}catch(_0x4b7ca5){return BPromise[_0x8541('0x20')](_0x4b7ca5);}return _0x594d08[_0x8541('0x21')]();};}function saveUpdates(_0xea4530,_0x5356f2){return function(_0x43ca7f){if(_0x43ca7f){return _0x43ca7f[_0x8541('0x22')](_0xea4530)[_0x8541('0x23')](function(_0x1991da){return _0x1991da;});}return null;};}function removeEntity(_0x2f1727,_0x972f99){return function(_0x2644fb){if(_0x2644fb){return _0x2644fb[_0x8541('0x24')]()[_0x8541('0x23')](function(){_0x2f1727[_0x8541('0x19')](0xcc)[_0x8541('0x1a')]();});}};}function handleEntityNotFound(_0x132013,_0x48ec14){return function(_0x1ff4fc){if(!_0x1ff4fc){_0x132013['sendStatus'](0x194);}return _0x1ff4fc;};}function handleError(_0x412950,_0x36f6d9){_0x36f6d9=_0x36f6d9||0x1f4;return function(_0x5cca4c){logger['error'](_0x5cca4c[_0x8541('0x25')]);if(_0x5cca4c['name']){delete _0x5cca4c[_0x8541('0x26')];}_0x412950[_0x8541('0x19')](_0x36f6d9)[_0x8541('0x27')](_0x5cca4c);};}exports[_0x8541('0x28')]=function(_0x2fbfd3,_0x33365c){var _0x40d6eb={},_0x37222b={},_0x18a450={'count':0x0,'rows':[]};var _0x189704=_[_0x8541('0x29')](db[_0x8541('0x2a')][_0x8541('0x2b')],function(_0x2d5428){return{'name':_0x2d5428['fieldName'],'type':_0x2d5428[_0x8541('0x2c')][_0x8541('0x2d')]};});_0x37222b[_0x8541('0x2e')]=_[_0x8541('0x29')](_0x189704,'name');_0x37222b[_0x8541('0x2f')]=_[_0x8541('0x30')](_0x2fbfd3[_0x8541('0x2f')]);_0x37222b[_0x8541('0x31')]=_[_0x8541('0x32')](_0x37222b[_0x8541('0x2e')],_0x37222b[_0x8541('0x2f')]);_0x40d6eb[_0x8541('0x33')]=_[_0x8541('0x32')](_0x37222b[_0x8541('0x2e')],qs[_0x8541('0x34')](_0x2fbfd3['query'][_0x8541('0x34')]));_0x40d6eb[_0x8541('0x33')]=_0x40d6eb[_0x8541('0x33')][_0x8541('0x35')]?_0x40d6eb[_0x8541('0x33')]:_0x37222b[_0x8541('0x2e')];if(!_0x2fbfd3[_0x8541('0x2f')][_0x8541('0x36')](_0x8541('0x37'))){_0x40d6eb[_0x8541('0x1d')]=qs[_0x8541('0x1d')](_0x2fbfd3[_0x8541('0x2f')][_0x8541('0x1d')]);_0x40d6eb[_0x8541('0x1c')]=qs[_0x8541('0x1c')](_0x2fbfd3[_0x8541('0x2f')][_0x8541('0x1c')]);}_0x40d6eb[_0x8541('0x38')]=qs[_0x8541('0x39')](_0x2fbfd3[_0x8541('0x2f')]['sort']);_0x40d6eb[_0x8541('0x3a')]=qs[_0x8541('0x31')](_[_0x8541('0x3b')](_0x2fbfd3[_0x8541('0x2f')],_0x37222b[_0x8541('0x31')]),_0x189704);if(_0x2fbfd3[_0x8541('0x2f')][_0x8541('0x3c')]){_0x40d6eb[_0x8541('0x3a')]=_[_0x8541('0x3d')](_0x40d6eb[_0x8541('0x3a')],{'$or':_[_0x8541('0x29')](_0x189704,function(_0x2fcd34){if(_0x2fcd34[_0x8541('0x2c')]!==_0x8541('0x3e')){var _0x578510={};_0x578510[_0x2fcd34['name']]={'$like':'%'+_0x2fbfd3[_0x8541('0x2f')][_0x8541('0x3c')]+'%'};return _0x578510;}})});}_0x40d6eb=_[_0x8541('0x3d')]({},_0x40d6eb,_0x2fbfd3['options']);var _0x1ab978={'where':_0x40d6eb[_0x8541('0x3a')]};return db[_0x8541('0x2a')][_0x8541('0x1e')](_0x1ab978)[_0x8541('0x23')](function(_0x3dc7d4){_0x18a450[_0x8541('0x1e')]=_0x3dc7d4;if(_0x2fbfd3['query'][_0x8541('0x3f')]){_0x40d6eb[_0x8541('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0x8541('0x41')](_0x40d6eb);})[_0x8541('0x23')](function(_0x1d21e3){_0x18a450[_0x8541('0x42')]=_0x1d21e3;return _0x18a450;})['then'](respondWithFilteredResult(_0x33365c,_0x40d6eb))['catch'](handleError(_0x33365c,null));};exports[_0x8541('0x43')]=function(_0x23d03e,_0xf2d43){var _0x41f782={'raw':!![],'where':{'id':_0x23d03e[_0x8541('0x44')]['id']}},_0x8214d4={};_0x8214d4[_0x8541('0x2e')]=_[_0x8541('0x30')](db[_0x8541('0x2a')][_0x8541('0x2b')]);_0x8214d4['query']=_[_0x8541('0x30')](_0x23d03e[_0x8541('0x2f')]);_0x8214d4[_0x8541('0x31')]=_[_0x8541('0x32')](_0x8214d4[_0x8541('0x2e')],_0x8214d4[_0x8541('0x2f')]);_0x41f782[_0x8541('0x33')]=_['intersection'](_0x8214d4['model'],qs[_0x8541('0x34')](_0x23d03e[_0x8541('0x2f')][_0x8541('0x34')]));_0x41f782['attributes']=_0x41f782[_0x8541('0x33')][_0x8541('0x35')]?_0x41f782[_0x8541('0x33')]:_0x8214d4[_0x8541('0x2e')];if(_0x23d03e['query'][_0x8541('0x3f')]){_0x41f782[_0x8541('0x40')]=[{'all':!![]}];}_0x41f782=_[_0x8541('0x3d')]({},_0x41f782,_0x23d03e['options']);return db['SalesforceField']['find'](_0x41f782)[_0x8541('0x23')](handleEntityNotFound(_0xf2d43,null))['then'](respondWithResult(_0xf2d43,null))[_0x8541('0x45')](handleError(_0xf2d43,null));};exports['create']=function(_0x3df339,_0x5be5e8){return db[_0x8541('0x2a')][_0x8541('0x46')](_0x3df339[_0x8541('0x47')],{})[_0x8541('0x23')](respondWithResult(_0x5be5e8,0xc9))['catch'](handleError(_0x5be5e8,null));};exports[_0x8541('0x22')]=function(_0x401edd,_0x1cdeff){if(_0x401edd[_0x8541('0x47')]['id']){delete _0x401edd[_0x8541('0x47')]['id'];}return db[_0x8541('0x2a')][_0x8541('0x48')]({'where':{'id':_0x401edd[_0x8541('0x44')]['id']}})[_0x8541('0x23')](handleEntityNotFound(_0x1cdeff,null))['then'](saveUpdates(_0x401edd[_0x8541('0x47')],null))['then'](respondWithResult(_0x1cdeff,null))[_0x8541('0x45')](handleError(_0x1cdeff,null));};exports[_0x8541('0x24')]=function(_0x3bf774,_0x35eed3){return db[_0x8541('0x2a')][_0x8541('0x48')]({'where':{'id':_0x3bf774[_0x8541('0x44')]['id']}})[_0x8541('0x23')](handleEntityNotFound(_0x35eed3,null))[_0x8541('0x23')](removeEntity(_0x35eed3,null))['catch'](handleError(_0x35eed3,null));};
\ No newline at end of file