Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / api / intSalesforceConfiguration / intSalesforceConfiguration.controller.js
1 const a342_0x55c9=['show','type','lodash','filter','SalesforceConfiguration','SalesforceField','offset','limit','VIRTUAL','order','include','getSubjects','pick','keys','params','findOne','sort','stack','name','destroy','create','catch','options','../../mysqldb','end','../../components/parsers/qs','intersection','map','query','length','model','body','sequelize','index','then','filters','includeAll','status','fieldName','error','rows','where','json','set','undefined','merge','getDescriptions','attributes','count','like','sendStatus','nolimit','getFields','rawAttributes','fields','key','../../config/logger'];(function(_0x302cfd,_0x271e36){const _0x55c980=function(_0x283fae){while(--_0x283fae){_0x302cfd['push'](_0x302cfd['shift']());}};_0x55c980(++_0x271e36);}(a342_0x55c9,0xe9));const a342_0x283f=function(_0x302cfd,_0x271e36){_0x302cfd=_0x302cfd-0x138;let _0x55c980=a342_0x55c9[_0x302cfd];return _0x55c980;};const a342_0x397445=a342_0x283f;'use strict';const _=require(a342_0x397445(0x16e)),qs=require(a342_0x397445(0x14c)),logger=require(a342_0x397445(0x16b))('api'),{db}=require(a342_0x397445(0x14a)),{Op}=require(a342_0x397445(0x153));function respondWithResult(_0x52676c,_0x4550c5){return _0x4550c5=_0x4550c5||0xc8,function(_0x521a8f){const _0x3eef36=a342_0x283f;if(_0x521a8f)return _0x52676c[_0x3eef36(0x158)](_0x4550c5)[_0x3eef36(0x15d)](_0x521a8f);};}function respondWithFilteredResult(_0x27af01,_0x4765d1){return function(_0x193b92){const _0x37d1cd=a342_0x283f;if(_0x193b92){const _0x4c6b07=_0x193b92[_0x37d1cd(0x163)],_0x41046b=_0x4765d1[_0x37d1cd(0x139)];let _0x3216ce=_0x4765d1['offset']+_0x4765d1['limit'],_0x410a6f;return _0x3216ce>=_0x4c6b07?(_0x3216ce=_0x4c6b07,_0x410a6f=0xc8):_0x410a6f=0xce,_0x27af01[_0x37d1cd(0x158)](_0x410a6f),_0x27af01[_0x37d1cd(0x15e)]('Content-Range',_0x41046b+'-'+_0x3216ce+'/'+_0x4c6b07)[_0x37d1cd(0x15d)](_0x193b92);}return null;};}function saveUpdates(_0x1173e4){return function(_0x1bf7b7){const _0x15b413=a342_0x283f;if(_0x1bf7b7)return _0x1bf7b7['update'](_0x1173e4)[_0x15b413(0x155)](function(_0x23fccf){return _0x23fccf;});return null;};}function removeEntity(_0xa46758){return function(_0x2623c6){const _0x2c86fa=a342_0x283f;if(_0x2623c6)return _0x2623c6[_0x2c86fa(0x146)]()[_0x2c86fa(0x155)](function(){const _0x43a9ed=_0x2c86fa;_0xa46758[_0x43a9ed(0x158)](0xcc)[_0x43a9ed(0x14b)]();});};}function handleEntityNotFound(_0x1ba77f){return function(_0x53990d){const _0x3dac3e=a342_0x283f;return!_0x53990d&&_0x1ba77f[_0x3dac3e(0x165)](0x194),_0x53990d;};}function handleError(_0xfa3bf7,_0x25345c){return _0x25345c=_0x25345c||0x1f4,function(_0x40639b){const _0x151564=a342_0x283f;logger[_0x151564(0x15a)](_0x40639b[_0x151564(0x144)]),_0x40639b[_0x151564(0x145)]&&delete _0x40639b[_0x151564(0x145)],_0xfa3bf7[_0x151564(0x158)](_0x25345c)['send'](_0x40639b);};}exports[a342_0x397445(0x154)]=function(_0xadfad9,_0x1154f4){const _0x4f97bb=a342_0x397445;let _0x2aaa97={};const _0xd65b93={},_0x1f6eae={'count':0x0,'rows':[]},_0x507fe8=_[_0x4f97bb(0x14e)](db['SalesforceConfiguration'][_0x4f97bb(0x168)],function(_0x58b84b){const _0x2117c3=_0x4f97bb;return{'name':_0x58b84b[_0x2117c3(0x159)],'type':_0x58b84b[_0x2117c3(0x16d)][_0x2117c3(0x16a)]};});_0xd65b93[_0x4f97bb(0x151)]=_[_0x4f97bb(0x14e)](_0x507fe8,_0x4f97bb(0x145)),_0xd65b93[_0x4f97bb(0x14f)]=_['keys'](_0xadfad9[_0x4f97bb(0x14f)]),_0xd65b93[_0x4f97bb(0x156)]=_[_0x4f97bb(0x14d)](_0xd65b93['model'],_0xd65b93['query']),_0x2aaa97[_0x4f97bb(0x162)]=_[_0x4f97bb(0x14d)](_0xd65b93[_0x4f97bb(0x151)],qs[_0x4f97bb(0x169)](_0xadfad9[_0x4f97bb(0x14f)][_0x4f97bb(0x169)])),_0x2aaa97[_0x4f97bb(0x162)]=_0x2aaa97[_0x4f97bb(0x162)][_0x4f97bb(0x150)]?_0x2aaa97[_0x4f97bb(0x162)]:_0xd65b93[_0x4f97bb(0x151)];typeof _0xadfad9[_0x4f97bb(0x14f)][_0x4f97bb(0x166)]===_0x4f97bb(0x15f)&&(_0x2aaa97[_0x4f97bb(0x13a)]=qs[_0x4f97bb(0x13a)](_0xadfad9[_0x4f97bb(0x14f)][_0x4f97bb(0x13a)]),_0x2aaa97[_0x4f97bb(0x139)]=qs['offset'](_0xadfad9[_0x4f97bb(0x14f)][_0x4f97bb(0x139)]));_0x2aaa97['order']=qs[_0x4f97bb(0x143)](_0xadfad9['query']['sort']),_0x2aaa97[_0x4f97bb(0x15c)]=qs[_0x4f97bb(0x156)](_[_0x4f97bb(0x13f)](_0xadfad9[_0x4f97bb(0x14f)],_0xd65b93['filters']),_0x507fe8);_0xadfad9[_0x4f97bb(0x14f)][_0x4f97bb(0x16f)]&&(_0x2aaa97[_0x4f97bb(0x15c)]=_[_0x4f97bb(0x160)](_0x2aaa97['where'],{[Op['or']]:_[_0x4f97bb(0x14e)](_0x507fe8,function(_0x4e3f27){const _0x581a1a=_0x4f97bb;if(_0x4e3f27['type']!==_0x581a1a(0x13b)){const _0x33307a={};return _0x33307a[_0x4e3f27['name']]={[Op[_0x581a1a(0x164)]]:'%'+_0xadfad9['query']['filter']+'%'},_0x33307a;}})}));_0x2aaa97=_[_0x4f97bb(0x160)]({},_0x2aaa97,_0xadfad9[_0x4f97bb(0x149)]);const _0x4389e6={'where':_0x2aaa97[_0x4f97bb(0x15c)]};return db[_0x4f97bb(0x170)][_0x4f97bb(0x163)](_0x4389e6)[_0x4f97bb(0x155)](function(_0x3b0a20){const _0x18a192=_0x4f97bb;return _0x1f6eae[_0x18a192(0x163)]=_0x3b0a20,_0xadfad9[_0x18a192(0x14f)][_0x18a192(0x157)]&&(_0x2aaa97['include']=[{'all':!![]}]),db[_0x18a192(0x170)]['findAll'](_0x2aaa97);})[_0x4f97bb(0x155)](function(_0x4da4b8){const _0x15db9f=_0x4f97bb;return _0x1f6eae[_0x15db9f(0x15b)]=_0x4da4b8,_0x1f6eae;})[_0x4f97bb(0x155)](respondWithFilteredResult(_0x1154f4,_0x2aaa97))['catch'](handleError(_0x1154f4,null));},exports[a342_0x397445(0x16c)]=function(_0x3a1985,_0x7f1c57){const _0x3ed0d8=a342_0x397445;let _0xabbbde={'raw':![],'where':{'id':_0x3a1985['params']['id']}};const _0x17442f={};return _0x17442f[_0x3ed0d8(0x151)]=_[_0x3ed0d8(0x140)](db[_0x3ed0d8(0x170)][_0x3ed0d8(0x168)]),_0x17442f['query']=_[_0x3ed0d8(0x140)](_0x3a1985[_0x3ed0d8(0x14f)]),_0x17442f[_0x3ed0d8(0x156)]=_[_0x3ed0d8(0x14d)](_0x17442f[_0x3ed0d8(0x151)],_0x17442f[_0x3ed0d8(0x14f)]),_0xabbbde[_0x3ed0d8(0x162)]=_[_0x3ed0d8(0x14d)](_0x17442f[_0x3ed0d8(0x151)],qs[_0x3ed0d8(0x169)](_0x3a1985[_0x3ed0d8(0x14f)][_0x3ed0d8(0x169)])),_0xabbbde['attributes']=_0xabbbde[_0x3ed0d8(0x162)][_0x3ed0d8(0x150)]?_0xabbbde[_0x3ed0d8(0x162)]:_0x17442f['model'],_0x3a1985[_0x3ed0d8(0x14f)][_0x3ed0d8(0x157)]&&(_0xabbbde[_0x3ed0d8(0x13d)]=[{'all':!![]}]),_0xabbbde=_[_0x3ed0d8(0x160)]({},_0xabbbde,_0x3a1985[_0x3ed0d8(0x149)]),db['SalesforceConfiguration'][_0x3ed0d8(0x142)](_0xabbbde)[_0x3ed0d8(0x155)](handleEntityNotFound(_0x7f1c57,null))[_0x3ed0d8(0x155)](respondWithResult(_0x7f1c57,null))[_0x3ed0d8(0x148)](handleError(_0x7f1c57,null));},exports[a342_0x397445(0x147)]=function(_0x2a5221,_0x30ab93){const _0x55c422=a342_0x397445;return db[_0x55c422(0x170)][_0x55c422(0x147)](_0x2a5221[_0x55c422(0x152)],{})[_0x55c422(0x155)](respondWithResult(_0x30ab93,0xc9))[_0x55c422(0x148)](handleError(_0x30ab93,null));},exports['update']=function(_0x371f2c,_0x415aaa){const _0x298380=a342_0x397445;return _0x371f2c[_0x298380(0x152)]['id']&&delete _0x371f2c[_0x298380(0x152)]['id'],db[_0x298380(0x170)][_0x298380(0x142)]({'where':{'id':_0x371f2c['params']['id']}})[_0x298380(0x155)](handleEntityNotFound(_0x415aaa,null))[_0x298380(0x155)](saveUpdates(_0x371f2c[_0x298380(0x152)],null))[_0x298380(0x155)](respondWithResult(_0x415aaa,null))[_0x298380(0x148)](handleError(_0x415aaa,null));},exports[a342_0x397445(0x146)]=function(_0x53ef7c,_0xc4a82e){const _0x3fba44=a342_0x397445;return db[_0x3fba44(0x170)][_0x3fba44(0x142)]({'where':{'id':_0x53ef7c['params']['id']}})['then'](handleEntityNotFound(_0xc4a82e,null))[_0x3fba44(0x155)](removeEntity(_0xc4a82e,null))['catch'](handleError(_0xc4a82e,null));},exports[a342_0x397445(0x167)]=function(_0x3646c7,_0x372720){const _0x3d0e73=a342_0x397445;let _0xf49687={};const _0x2c1f87={};let _0x33e652,_0x2d1e2d;return db['SalesforceConfiguration'][_0x3d0e73(0x142)]({'where':{'id':_0x3646c7[_0x3d0e73(0x141)]['id']}})[_0x3d0e73(0x155)](handleEntityNotFound(_0x372720,null))[_0x3d0e73(0x155)](function(_0x3ea881){const _0x54930f=_0x3d0e73;if(_0x3ea881)return _0x33e652=_0x3ea881,_0x2c1f87['model']=_['keys'](db[_0x54930f(0x138)][_0x54930f(0x168)]),_0x2c1f87[_0x54930f(0x14f)]=_['keys'](_0x3646c7[_0x54930f(0x14f)]),_0x2c1f87[_0x54930f(0x156)]=_[_0x54930f(0x14d)](_0x2c1f87[_0x54930f(0x151)],_0x2c1f87[_0x54930f(0x14f)]),_0xf49687['attributes']=_[_0x54930f(0x14d)](_0x2c1f87['model'],qs[_0x54930f(0x169)](_0x3646c7['query'][_0x54930f(0x169)])),_0xf49687[_0x54930f(0x162)]=_0xf49687[_0x54930f(0x162)][_0x54930f(0x150)]?_0xf49687[_0x54930f(0x162)]:_0x2c1f87[_0x54930f(0x151)],_0xf49687[_0x54930f(0x13c)]=qs['sort'](_0x3646c7[_0x54930f(0x14f)][_0x54930f(0x143)]),_0xf49687['where']=qs[_0x54930f(0x156)](_[_0x54930f(0x13f)](_0x3646c7['query'],_0x2c1f87[_0x54930f(0x156)])),_0x3646c7[_0x54930f(0x14f)][_0x54930f(0x16f)]&&(_0xf49687[_0x54930f(0x15c)]=_[_0x54930f(0x160)](_0xf49687[_0x54930f(0x15c)],{[Op['or']]:_[_0x54930f(0x14e)](_0xf49687[_0x54930f(0x162)],function(_0x5f321a){const _0x377be2=_0x54930f,_0x543011={};return _0x543011[_0x5f321a]={[Op['like']]:'%'+_0x3646c7[_0x377be2(0x14f)][_0x377be2(0x16f)]+'%'},_0x543011;})})),_0xf49687=_['merge']({},_0xf49687,_0x3646c7[_0x54930f(0x149)]),_0x33e652['getFields'](_0xf49687);})[_0x3d0e73(0x155)](function(_0x2cadcc){const _0x185310=_0x3d0e73;if(_0x2cadcc)return _0x2d1e2d=_0x2cadcc[_0x185310(0x150)],typeof _0x3646c7[_0x185310(0x14f)][_0x185310(0x166)]===_0x185310(0x15f)&&(_0xf49687['limit']=qs[_0x185310(0x13a)](_0x3646c7['query'][_0x185310(0x13a)]),_0xf49687[_0x185310(0x139)]=qs[_0x185310(0x139)](_0x3646c7['query'][_0x185310(0x139)])),_0x33e652[_0x185310(0x167)](_0xf49687);})[_0x3d0e73(0x155)](function(_0x4f8c16){if(_0x4f8c16)return _0x4f8c16?{'count':_0x2d1e2d,'rows':_0x4f8c16}:null;})[_0x3d0e73(0x155)](respondWithResult(_0x372720,null))[_0x3d0e73(0x148)](handleError(_0x372720,null));},exports[a342_0x397445(0x13e)]=function(_0x3b35e7,_0xbc51d0){const _0x2eed08=a342_0x397445;let _0x5315fd={};const _0x26a69b={};let _0x130072,_0x36bfff;return db[_0x2eed08(0x170)]['findOne']({'where':{'id':_0x3b35e7[_0x2eed08(0x141)]['id']}})[_0x2eed08(0x155)](handleEntityNotFound(_0xbc51d0,null))[_0x2eed08(0x155)](function(_0x60c6c2){const _0x11700e=_0x2eed08;if(_0x60c6c2)return _0x130072=_0x60c6c2,_0x26a69b[_0x11700e(0x151)]=_[_0x11700e(0x140)](db[_0x11700e(0x138)][_0x11700e(0x168)]),_0x26a69b[_0x11700e(0x14f)]=_[_0x11700e(0x140)](_0x3b35e7[_0x11700e(0x14f)]),_0x26a69b['filters']=_[_0x11700e(0x14d)](_0x26a69b[_0x11700e(0x151)],_0x26a69b[_0x11700e(0x14f)]),_0x5315fd[_0x11700e(0x162)]=_['intersection'](_0x26a69b['model'],qs['fields'](_0x3b35e7['query'][_0x11700e(0x169)])),_0x5315fd[_0x11700e(0x162)]=_0x5315fd[_0x11700e(0x162)]['length']?_0x5315fd['attributes']:_0x26a69b['model'],_0x5315fd['order']=qs[_0x11700e(0x143)](_0x3b35e7[_0x11700e(0x14f)][_0x11700e(0x143)]),_0x5315fd[_0x11700e(0x15c)]=qs[_0x11700e(0x156)](_[_0x11700e(0x13f)](_0x3b35e7[_0x11700e(0x14f)],_0x26a69b[_0x11700e(0x156)])),_0x3b35e7['query']['filter']&&(_0x5315fd[_0x11700e(0x15c)]=_[_0x11700e(0x160)](_0x5315fd[_0x11700e(0x15c)],{[Op['or']]:_['map'](_0x5315fd[_0x11700e(0x162)],function(_0x2f4b15){const _0x44a447=_0x11700e,_0x4dcaf4={};return _0x4dcaf4[_0x2f4b15]={[Op[_0x44a447(0x164)]]:'%'+_0x3b35e7[_0x44a447(0x14f)][_0x44a447(0x16f)]+'%'},_0x4dcaf4;})})),_0x5315fd=_[_0x11700e(0x160)]({},_0x5315fd,_0x3b35e7[_0x11700e(0x149)]),_0x130072[_0x11700e(0x13e)](_0x5315fd);})[_0x2eed08(0x155)](function(_0x21d721){const _0x117003=_0x2eed08;if(_0x21d721)return _0x36bfff=_0x21d721['length'],typeof _0x3b35e7[_0x117003(0x14f)][_0x117003(0x166)]===_0x117003(0x15f)&&(_0x5315fd[_0x117003(0x13a)]=qs['limit'](_0x3b35e7[_0x117003(0x14f)]['limit']),_0x5315fd[_0x117003(0x139)]=qs[_0x117003(0x139)](_0x3b35e7[_0x117003(0x14f)][_0x117003(0x139)])),_0x130072[_0x117003(0x13e)](_0x5315fd);})[_0x2eed08(0x155)](function(_0x152bd0){if(_0x152bd0)return _0x152bd0?{'count':_0x36bfff,'rows':_0x152bd0}:null;})[_0x2eed08(0x155)](respondWithResult(_0xbc51d0,null))[_0x2eed08(0x148)](handleError(_0xbc51d0,null));},exports[a342_0x397445(0x161)]=function(_0x1f7ff1,_0x5ef3a8){const _0x1073fc=a342_0x397445;let _0x323c58={};const _0x160573={};let _0xe21f35,_0x20b37f;return db['SalesforceConfiguration'][_0x1073fc(0x142)]({'where':{'id':_0x1f7ff1[_0x1073fc(0x141)]['id']}})[_0x1073fc(0x155)](handleEntityNotFound(_0x5ef3a8,null))['then'](function(_0x85ac9d){const _0x6e020f=_0x1073fc;if(_0x85ac9d)return _0xe21f35=_0x85ac9d,_0x160573['model']=_[_0x6e020f(0x140)](db[_0x6e020f(0x138)]['rawAttributes']),_0x160573[_0x6e020f(0x14f)]=_[_0x6e020f(0x140)](_0x1f7ff1[_0x6e020f(0x14f)]),_0x160573[_0x6e020f(0x156)]=_['intersection'](_0x160573['model'],_0x160573[_0x6e020f(0x14f)]),_0x323c58['attributes']=_[_0x6e020f(0x14d)](_0x160573[_0x6e020f(0x151)],qs[_0x6e020f(0x169)](_0x1f7ff1[_0x6e020f(0x14f)]['fields'])),_0x323c58[_0x6e020f(0x162)]=_0x323c58[_0x6e020f(0x162)][_0x6e020f(0x150)]?_0x323c58[_0x6e020f(0x162)]:_0x160573['model'],_0x323c58['order']=qs['sort'](_0x1f7ff1[_0x6e020f(0x14f)][_0x6e020f(0x143)]),_0x323c58['where']=qs[_0x6e020f(0x156)](_[_0x6e020f(0x13f)](_0x1f7ff1['query'],_0x160573['filters'])),_0x1f7ff1[_0x6e020f(0x14f)]['filter']&&(_0x323c58[_0x6e020f(0x15c)]=_[_0x6e020f(0x160)](_0x323c58[_0x6e020f(0x15c)],{[Op['or']]:_[_0x6e020f(0x14e)](_0x323c58['attributes'],function(_0x19d698){const _0x3b41ca=_0x6e020f,_0x400373={};return _0x400373[_0x19d698]={[Op[_0x3b41ca(0x164)]]:'%'+_0x1f7ff1['query'][_0x3b41ca(0x16f)]+'%'},_0x400373;})})),_0x323c58=_[_0x6e020f(0x160)]({},_0x323c58,_0x1f7ff1[_0x6e020f(0x149)]),_0xe21f35['getDescriptions'](_0x323c58);})[_0x1073fc(0x155)](function(_0x3ca627){const _0x114e3e=_0x1073fc;if(_0x3ca627)return _0x20b37f=_0x3ca627[_0x114e3e(0x150)],typeof _0x1f7ff1[_0x114e3e(0x14f)][_0x114e3e(0x166)]===_0x114e3e(0x15f)&&(_0x323c58[_0x114e3e(0x13a)]=qs[_0x114e3e(0x13a)](_0x1f7ff1[_0x114e3e(0x14f)][_0x114e3e(0x13a)]),_0x323c58['offset']=qs['offset'](_0x1f7ff1['query']['offset'])),_0xe21f35[_0x114e3e(0x161)](_0x323c58);})[_0x1073fc(0x155)](function(_0x3284ef){if(_0x3284ef)return _0x3284ef?{'count':_0x20b37f,'rows':_0x3284ef}:null;})[_0x1073fc(0x155)](respondWithResult(_0x5ef3a8,null))[_0x1073fc(0x148)](handleError(_0x5ef3a8,null));};