Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / api / intSalesforceField / intSalesforceField.controller.js
index 0280968..263572c 100644 (file)
@@ -1 +1 @@
-const a347_0x12e1=['map','sort','create','SalesforceField','update','status','Content-Range','rawAttributes','options','attributes','name','type','keys','../../components/parsers/qs','pick','query','limit','count','intersection','../../mysqldb','../../config/logger','json','merge','model','offset','key','findAll','fields','error','filters','body','catch','destroy','findOne','then','fieldName','params','rows','show','send','nolimit','includeAll','sequelize','where','length','stack','include','sendStatus','lodash'];(function(_0x2d7041,_0xb7d412){const _0x12e17d=function(_0x118842){while(--_0x118842){_0x2d7041['push'](_0x2d7041['shift']());}};_0x12e17d(++_0xb7d412);}(a347_0x12e1,0xaf));const a347_0x1188=function(_0x2d7041,_0xb7d412){_0x2d7041=_0x2d7041-0x74;let _0x12e17d=a347_0x12e1[_0x2d7041];return _0x12e17d;};const a347_0x47d619=a347_0x1188;'use strict';const _=require(a347_0x47d619(0x88)),qs=require(a347_0x47d619(0x96)),logger=require(a347_0x47d619(0x9d))('api'),{db}=require(a347_0x47d619(0x9c)),{Op}=require(a347_0x47d619(0x82));function respondWithResult(_0x163bdd,_0x33ca39){return _0x33ca39=_0x33ca39||0xc8,function(_0x437d44){const _0x3ae859=a347_0x1188;if(_0x437d44)return _0x163bdd[_0x3ae859(0x8e)](_0x33ca39)[_0x3ae859(0x9e)](_0x437d44);};}function respondWithFilteredResult(_0x34081b,_0x4b99cb){return function(_0x468fda){const _0x9c9ed7=a347_0x1188;if(_0x468fda){const _0x3e4542=_0x468fda[_0x9c9ed7(0x9a)],_0x824a6f=_0x4b99cb[_0x9c9ed7(0xa1)];let _0x5690ce=_0x4b99cb['offset']+_0x4b99cb['limit'],_0x393c64;return _0x5690ce>=_0x3e4542?(_0x5690ce=_0x3e4542,_0x393c64=0xc8):_0x393c64=0xce,_0x34081b[_0x9c9ed7(0x8e)](_0x393c64),_0x34081b['set'](_0x9c9ed7(0x8f),_0x824a6f+'-'+_0x5690ce+'/'+_0x3e4542)['json'](_0x468fda);}return null;};}function saveUpdates(_0x3c85dd){return function(_0x4308c5){const _0x3cece2=a347_0x1188;if(_0x4308c5)return _0x4308c5[_0x3cece2(0x8d)](_0x3c85dd)['then'](function(_0x5e992d){return _0x5e992d;});return null;};}function removeEntity(_0x25a255){return function(_0x30257e){const _0x4401b2=a347_0x1188;if(_0x30257e)return _0x30257e[_0x4401b2(0x78)]()[_0x4401b2(0x7a)](function(){_0x25a255['status'](0xcc)['end']();});};}function handleEntityNotFound(_0x3f313a){return function(_0x321a60){const _0x184cd2=a347_0x1188;return!_0x321a60&&_0x3f313a[_0x184cd2(0x87)](0x194),_0x321a60;};}function handleError(_0x405dfd,_0x573911){return _0x573911=_0x573911||0x1f4,function(_0x3f20c2){const _0x3823f3=a347_0x1188;logger[_0x3823f3(0x74)](_0x3f20c2[_0x3823f3(0x85)]),_0x3f20c2[_0x3823f3(0x93)]&&delete _0x3f20c2['name'],_0x405dfd[_0x3823f3(0x8e)](_0x573911)[_0x3823f3(0x7f)](_0x3f20c2);};}exports['index']=function(_0x419310,_0x17c881){const _0x5651f5=a347_0x47d619;let _0x19f7b3={};const _0x9555be={},_0x2a4277={'count':0x0,'rows':[]},_0x3d81cc=_[_0x5651f5(0x89)](db['SalesforceField'][_0x5651f5(0x90)],function(_0x67e147){const _0x2bba0c=_0x5651f5;return{'name':_0x67e147[_0x2bba0c(0x7b)],'type':_0x67e147[_0x2bba0c(0x94)][_0x2bba0c(0xa2)]};});_0x9555be[_0x5651f5(0xa0)]=_[_0x5651f5(0x89)](_0x3d81cc,_0x5651f5(0x93)),_0x9555be[_0x5651f5(0x98)]=_[_0x5651f5(0x95)](_0x419310[_0x5651f5(0x98)]),_0x9555be[_0x5651f5(0x75)]=_['intersection'](_0x9555be[_0x5651f5(0xa0)],_0x9555be[_0x5651f5(0x98)]),_0x19f7b3[_0x5651f5(0x92)]=_[_0x5651f5(0x9b)](_0x9555be[_0x5651f5(0xa0)],qs[_0x5651f5(0xa4)](_0x419310[_0x5651f5(0x98)]['fields'])),_0x19f7b3[_0x5651f5(0x92)]=_0x19f7b3[_0x5651f5(0x92)][_0x5651f5(0x84)]?_0x19f7b3[_0x5651f5(0x92)]:_0x9555be[_0x5651f5(0xa0)];typeof _0x419310[_0x5651f5(0x98)][_0x5651f5(0x80)]==='undefined'&&(_0x19f7b3[_0x5651f5(0x99)]=qs['limit'](_0x419310[_0x5651f5(0x98)]['limit']),_0x19f7b3[_0x5651f5(0xa1)]=qs[_0x5651f5(0xa1)](_0x419310['query'][_0x5651f5(0xa1)]));_0x19f7b3['order']=qs[_0x5651f5(0x8a)](_0x419310[_0x5651f5(0x98)][_0x5651f5(0x8a)]),_0x19f7b3[_0x5651f5(0x83)]=qs[_0x5651f5(0x75)](_[_0x5651f5(0x97)](_0x419310[_0x5651f5(0x98)],_0x9555be[_0x5651f5(0x75)]),_0x3d81cc);_0x419310['query']['filter']&&(_0x19f7b3['where']=_['merge'](_0x19f7b3[_0x5651f5(0x83)],{[Op['or']]:_[_0x5651f5(0x89)](_0x3d81cc,function(_0x262dda){const _0x4590e6=_0x5651f5;if(_0x262dda[_0x4590e6(0x94)]!=='VIRTUAL'){const _0x1bde29={};return _0x1bde29[_0x262dda[_0x4590e6(0x93)]]={[Op['like']]:'%'+_0x419310[_0x4590e6(0x98)]['filter']+'%'},_0x1bde29;}})}));_0x19f7b3=_[_0x5651f5(0x9f)]({},_0x19f7b3,_0x419310['options']);const _0x14796d={'where':_0x19f7b3[_0x5651f5(0x83)]};return db[_0x5651f5(0x8c)][_0x5651f5(0x9a)](_0x14796d)[_0x5651f5(0x7a)](function(_0x2497d4){const _0xa3aedf=_0x5651f5;return _0x2a4277['count']=_0x2497d4,_0x419310[_0xa3aedf(0x98)][_0xa3aedf(0x81)]&&(_0x19f7b3[_0xa3aedf(0x86)]=[{'all':!![]}]),db[_0xa3aedf(0x8c)][_0xa3aedf(0xa3)](_0x19f7b3);})[_0x5651f5(0x7a)](function(_0x367bf8){const _0x45a401=_0x5651f5;return _0x2a4277[_0x45a401(0x7d)]=_0x367bf8,_0x2a4277;})[_0x5651f5(0x7a)](respondWithFilteredResult(_0x17c881,_0x19f7b3))['catch'](handleError(_0x17c881,null));},exports[a347_0x47d619(0x7e)]=function(_0x45e360,_0x27ddff){const _0x4d2a9c=a347_0x47d619;let _0x40b368={'raw':!![],'where':{'id':_0x45e360['params']['id']}};const _0x55e9c7={};return _0x55e9c7['model']=_[_0x4d2a9c(0x95)](db[_0x4d2a9c(0x8c)][_0x4d2a9c(0x90)]),_0x55e9c7[_0x4d2a9c(0x98)]=_['keys'](_0x45e360[_0x4d2a9c(0x98)]),_0x55e9c7[_0x4d2a9c(0x75)]=_[_0x4d2a9c(0x9b)](_0x55e9c7[_0x4d2a9c(0xa0)],_0x55e9c7['query']),_0x40b368[_0x4d2a9c(0x92)]=_[_0x4d2a9c(0x9b)](_0x55e9c7['model'],qs[_0x4d2a9c(0xa4)](_0x45e360['query'][_0x4d2a9c(0xa4)])),_0x40b368['attributes']=_0x40b368[_0x4d2a9c(0x92)]['length']?_0x40b368[_0x4d2a9c(0x92)]:_0x55e9c7[_0x4d2a9c(0xa0)],_0x45e360['query'][_0x4d2a9c(0x81)]&&(_0x40b368['include']=[{'all':!![]}]),_0x40b368=_[_0x4d2a9c(0x9f)]({},_0x40b368,_0x45e360[_0x4d2a9c(0x91)]),db['SalesforceField'][_0x4d2a9c(0x79)](_0x40b368)[_0x4d2a9c(0x7a)](handleEntityNotFound(_0x27ddff,null))[_0x4d2a9c(0x7a)](respondWithResult(_0x27ddff,null))[_0x4d2a9c(0x77)](handleError(_0x27ddff,null));},exports['create']=function(_0x46653e,_0x11cc9a){const _0x483b34=a347_0x47d619;return db[_0x483b34(0x8c)][_0x483b34(0x8b)](_0x46653e[_0x483b34(0x76)],{})[_0x483b34(0x7a)](respondWithResult(_0x11cc9a,0xc9))[_0x483b34(0x77)](handleError(_0x11cc9a,null));},exports[a347_0x47d619(0x8d)]=function(_0x344a23,_0x57fd96){const _0x1694c0=a347_0x47d619;return _0x344a23[_0x1694c0(0x76)]['id']&&delete _0x344a23['body']['id'],db['SalesforceField']['findOne']({'where':{'id':_0x344a23[_0x1694c0(0x7c)]['id']}})[_0x1694c0(0x7a)](handleEntityNotFound(_0x57fd96,null))[_0x1694c0(0x7a)](saveUpdates(_0x344a23['body'],null))['then'](respondWithResult(_0x57fd96,null))[_0x1694c0(0x77)](handleError(_0x57fd96,null));},exports[a347_0x47d619(0x78)]=function(_0x331557,_0x521b00){const _0x240651=a347_0x47d619;return db[_0x240651(0x8c)]['findOne']({'where':{'id':_0x331557[_0x240651(0x7c)]['id']}})[_0x240651(0x7a)](handleEntityNotFound(_0x521b00,null))[_0x240651(0x7a)](removeEntity(_0x521b00,null))[_0x240651(0x77)](handleError(_0x521b00,null));};
\ No newline at end of file
+const a347_0x10cc=['api','type','intersection','sort','where','keys','order','include','SalesforceField','map','merge','undefined','key','options','index','count','VIRTUAL','body','query','limit','fieldName','stack','rawAttributes','set','send','fields','status','nolimit','../../components/parsers/qs','offset','model','sendStatus','update','Content-Range','length','like','findOne','../../config/logger','sequelize','json','catch','then','filters','show','findAll','end','filter','params','name','destroy','attributes','create','rows'];(function(_0xc20c57,_0x5a777a){const _0x10cc71=function(_0x4793fb){while(--_0x4793fb){_0xc20c57['push'](_0xc20c57['shift']());}};_0x10cc71(++_0x5a777a);}(a347_0x10cc,0x7b));const a347_0x4793=function(_0xc20c57,_0x5a777a){_0xc20c57=_0xc20c57-0x173;let _0x10cc71=a347_0x10cc[_0xc20c57];return _0x10cc71;};const a347_0x3400da=a347_0x4793;'use strict';const _=require('lodash'),qs=require(a347_0x3400da(0x17e)),logger=require(a347_0x3400da(0x187))(a347_0x3400da(0x197)),{db}=require('../../mysqldb'),{Op}=require(a347_0x3400da(0x188));function respondWithResult(_0x5e3896,_0x43336a){return _0x43336a=_0x43336a||0xc8,function(_0x331691){const _0x4b47b8=a347_0x4793;if(_0x331691)return _0x5e3896['status'](_0x43336a)[_0x4b47b8(0x189)](_0x331691);};}function respondWithFilteredResult(_0x881bf2,_0x693a8f){return function(_0x169953){const _0x566656=a347_0x4793;if(_0x169953){const _0x578ee0=_0x169953[_0x566656(0x1a6)],_0x4eae72=_0x693a8f[_0x566656(0x17f)];let _0x55b09d=_0x693a8f[_0x566656(0x17f)]+_0x693a8f[_0x566656(0x175)],_0x3d2a41;return _0x55b09d>=_0x578ee0?(_0x55b09d=_0x578ee0,_0x3d2a41=0xc8):_0x3d2a41=0xce,_0x881bf2['status'](_0x3d2a41),_0x881bf2[_0x566656(0x179)](_0x566656(0x183),_0x4eae72+'-'+_0x55b09d+'/'+_0x578ee0)[_0x566656(0x189)](_0x169953);}return null;};}function saveUpdates(_0x139e6b){return function(_0x5a2ccd){const _0x1bf26e=a347_0x4793;if(_0x5a2ccd)return _0x5a2ccd[_0x1bf26e(0x182)](_0x139e6b)['then'](function(_0x551ce0){return _0x551ce0;});return null;};}function removeEntity(_0x4262cd){return function(_0x303ccc){const _0x16d382=a347_0x4793;if(_0x303ccc)return _0x303ccc['destroy']()[_0x16d382(0x18b)](function(){const _0x2c5a70=_0x16d382;_0x4262cd[_0x2c5a70(0x17c)](0xcc)[_0x2c5a70(0x18f)]();});};}function handleEntityNotFound(_0x2620b7){return function(_0x346acb){const _0x446f8d=a347_0x4793;return!_0x346acb&&_0x2620b7[_0x446f8d(0x181)](0x194),_0x346acb;};}function handleError(_0x4da1b8,_0x893d3a){return _0x893d3a=_0x893d3a||0x1f4,function(_0x36bec9){const _0x4f22d8=a347_0x4793;logger['error'](_0x36bec9[_0x4f22d8(0x177)]),_0x36bec9[_0x4f22d8(0x192)]&&delete _0x36bec9[_0x4f22d8(0x192)],_0x4da1b8[_0x4f22d8(0x17c)](_0x893d3a)[_0x4f22d8(0x17a)](_0x36bec9);};}exports[a347_0x3400da(0x1a5)]=function(_0x2bdbc5,_0x2093b0){const _0x54c1d3=a347_0x3400da;let _0x387a84={};const _0x532b22={},_0x3aa5c6={'count':0x0,'rows':[]},_0x51df22=_[_0x54c1d3(0x1a0)](db['SalesforceField'][_0x54c1d3(0x178)],function(_0x2be211){const _0x58e988=_0x54c1d3;return{'name':_0x2be211[_0x58e988(0x176)],'type':_0x2be211[_0x58e988(0x198)][_0x58e988(0x1a3)]};});_0x532b22[_0x54c1d3(0x180)]=_[_0x54c1d3(0x1a0)](_0x51df22,_0x54c1d3(0x192)),_0x532b22[_0x54c1d3(0x174)]=_['keys'](_0x2bdbc5[_0x54c1d3(0x174)]),_0x532b22[_0x54c1d3(0x18c)]=_[_0x54c1d3(0x199)](_0x532b22['model'],_0x532b22[_0x54c1d3(0x174)]),_0x387a84['attributes']=_[_0x54c1d3(0x199)](_0x532b22[_0x54c1d3(0x180)],qs[_0x54c1d3(0x17b)](_0x2bdbc5['query'][_0x54c1d3(0x17b)])),_0x387a84[_0x54c1d3(0x194)]=_0x387a84['attributes']['length']?_0x387a84['attributes']:_0x532b22[_0x54c1d3(0x180)];typeof _0x2bdbc5['query'][_0x54c1d3(0x17d)]===_0x54c1d3(0x1a2)&&(_0x387a84['limit']=qs['limit'](_0x2bdbc5[_0x54c1d3(0x174)]['limit']),_0x387a84[_0x54c1d3(0x17f)]=qs[_0x54c1d3(0x17f)](_0x2bdbc5['query'][_0x54c1d3(0x17f)]));_0x387a84[_0x54c1d3(0x19d)]=qs[_0x54c1d3(0x19a)](_0x2bdbc5['query'][_0x54c1d3(0x19a)]),_0x387a84[_0x54c1d3(0x19b)]=qs['filters'](_['pick'](_0x2bdbc5[_0x54c1d3(0x174)],_0x532b22[_0x54c1d3(0x18c)]),_0x51df22);_0x2bdbc5[_0x54c1d3(0x174)][_0x54c1d3(0x190)]&&(_0x387a84[_0x54c1d3(0x19b)]=_[_0x54c1d3(0x1a1)](_0x387a84['where'],{[Op['or']]:_[_0x54c1d3(0x1a0)](_0x51df22,function(_0x2bb458){const _0x45fef2=_0x54c1d3;if(_0x2bb458['type']!==_0x45fef2(0x1a7)){const _0xdf150={};return _0xdf150[_0x2bb458[_0x45fef2(0x192)]]={[Op[_0x45fef2(0x185)]]:'%'+_0x2bdbc5[_0x45fef2(0x174)]['filter']+'%'},_0xdf150;}})}));_0x387a84=_[_0x54c1d3(0x1a1)]({},_0x387a84,_0x2bdbc5[_0x54c1d3(0x1a4)]);const _0x445d06={'where':_0x387a84[_0x54c1d3(0x19b)]};return db[_0x54c1d3(0x19f)][_0x54c1d3(0x1a6)](_0x445d06)['then'](function(_0x3cca55){const _0x4cd878=_0x54c1d3;return _0x3aa5c6['count']=_0x3cca55,_0x2bdbc5['query']['includeAll']&&(_0x387a84[_0x4cd878(0x19e)]=[{'all':!![]}]),db[_0x4cd878(0x19f)][_0x4cd878(0x18e)](_0x387a84);})[_0x54c1d3(0x18b)](function(_0x3a6022){const _0x121b67=_0x54c1d3;return _0x3aa5c6[_0x121b67(0x196)]=_0x3a6022,_0x3aa5c6;})[_0x54c1d3(0x18b)](respondWithFilteredResult(_0x2093b0,_0x387a84))[_0x54c1d3(0x18a)](handleError(_0x2093b0,null));},exports[a347_0x3400da(0x18d)]=function(_0x3433ba,_0xe420ec){const _0x137868=a347_0x3400da;let _0x3d5a21={'raw':!![],'where':{'id':_0x3433ba[_0x137868(0x191)]['id']}};const _0x3eddfd={};return _0x3eddfd[_0x137868(0x180)]=_[_0x137868(0x19c)](db[_0x137868(0x19f)][_0x137868(0x178)]),_0x3eddfd[_0x137868(0x174)]=_[_0x137868(0x19c)](_0x3433ba[_0x137868(0x174)]),_0x3eddfd[_0x137868(0x18c)]=_['intersection'](_0x3eddfd[_0x137868(0x180)],_0x3eddfd['query']),_0x3d5a21[_0x137868(0x194)]=_[_0x137868(0x199)](_0x3eddfd[_0x137868(0x180)],qs[_0x137868(0x17b)](_0x3433ba['query'][_0x137868(0x17b)])),_0x3d5a21['attributes']=_0x3d5a21[_0x137868(0x194)][_0x137868(0x184)]?_0x3d5a21[_0x137868(0x194)]:_0x3eddfd[_0x137868(0x180)],_0x3433ba[_0x137868(0x174)]['includeAll']&&(_0x3d5a21[_0x137868(0x19e)]=[{'all':!![]}]),_0x3d5a21=_[_0x137868(0x1a1)]({},_0x3d5a21,_0x3433ba['options']),db['SalesforceField'][_0x137868(0x186)](_0x3d5a21)[_0x137868(0x18b)](handleEntityNotFound(_0xe420ec,null))['then'](respondWithResult(_0xe420ec,null))[_0x137868(0x18a)](handleError(_0xe420ec,null));},exports[a347_0x3400da(0x195)]=function(_0x55a636,_0x49e928){const _0x2f0759=a347_0x3400da;return db[_0x2f0759(0x19f)][_0x2f0759(0x195)](_0x55a636[_0x2f0759(0x173)],{})['then'](respondWithResult(_0x49e928,0xc9))['catch'](handleError(_0x49e928,null));},exports[a347_0x3400da(0x182)]=function(_0x1658d7,_0xc12d7f){const _0x33ad9d=a347_0x3400da;return _0x1658d7[_0x33ad9d(0x173)]['id']&&delete _0x1658d7[_0x33ad9d(0x173)]['id'],db[_0x33ad9d(0x19f)]['findOne']({'where':{'id':_0x1658d7[_0x33ad9d(0x191)]['id']}})[_0x33ad9d(0x18b)](handleEntityNotFound(_0xc12d7f,null))[_0x33ad9d(0x18b)](saveUpdates(_0x1658d7['body'],null))[_0x33ad9d(0x18b)](respondWithResult(_0xc12d7f,null))[_0x33ad9d(0x18a)](handleError(_0xc12d7f,null));},exports[a347_0x3400da(0x193)]=function(_0x5108c6,_0x78a4f6){const _0xe9822a=a347_0x3400da;return db[_0xe9822a(0x19f)][_0xe9822a(0x186)]({'where':{'id':_0x5108c6[_0xe9822a(0x191)]['id']}})['then'](handleEntityNotFound(_0x78a4f6,null))[_0xe9822a(0x18b)](removeEntity(_0x78a4f6,null))['catch'](handleError(_0x78a4f6,null));};
\ No newline at end of file