Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / variable / variable.controller.js
index b13b394..73d6661 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf981=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','Variables','destroy','error','stack','name','send','render','body','message','account','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','fields','find','catch','create','user','get','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf981,0xe6));var _0x1f98=function(_0x111475,_0x4314a5){_0x111475=_0x111475-0x0;var _0x4a273b=_0xf981[_0x111475];return _0x4a273b;};'use strict';var emlformat=require(_0x1f98('0x0'));var rimraf=require(_0x1f98('0x1'));var zipdir=require(_0x1f98('0x2'));var jsonpatch=require(_0x1f98('0x3'));var rp=require(_0x1f98('0x4'));var moment=require(_0x1f98('0x5'));var BPromise=require(_0x1f98('0x6'));var Mustache=require(_0x1f98('0x7'));var util=require('util');var path=require(_0x1f98('0x8'));var sox=require(_0x1f98('0x9'));var csv=require(_0x1f98('0xa'));var ejs=require(_0x1f98('0xb'));var fs=require('fs');var fs_extra=require(_0x1f98('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f98('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f98('0xe'));var toCsv=require(_0x1f98('0xa'));var querystring=require(_0x1f98('0xf'));var Papa=require(_0x1f98('0x10'));var Redis=require(_0x1f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1f98('0x12'));var as=require(_0x1f98('0x13'));var hardwareService=require(_0x1f98('0x14'));var logger=require(_0x1f98('0x15'))('api');var utils=require(_0x1f98('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1f98('0x17'));var db=require(_0x1f98('0x18'))['db'];function respondWithStatusCode(_0x47322b,_0x4d14ae){_0x4d14ae=_0x4d14ae||0xcc;return function(_0x5e34f9){if(_0x5e34f9){return _0x47322b['sendStatus'](_0x4d14ae);}return _0x47322b[_0x1f98('0x19')](_0x4d14ae)[_0x1f98('0x1a')]();};}function respondWithResult(_0x2e599d,_0x2d9c83){_0x2d9c83=_0x2d9c83||0xc8;return function(_0x87ffbd){if(_0x87ffbd){return _0x2e599d[_0x1f98('0x19')](_0x2d9c83)[_0x1f98('0x1b')](_0x87ffbd);}};}function respondWithFilteredResult(_0x5d38ba,_0x1a21cd){return function(_0x547b5c){if(_0x547b5c){var _0x2fc335=typeof _0x1a21cd['offset']===_0x1f98('0x1c')&&typeof _0x1a21cd[_0x1f98('0x1d')]===_0x1f98('0x1c');var _0x466bbd=_0x547b5c[_0x1f98('0x1e')];var _0x414268=_0x2fc335?0x0:_0x1a21cd[_0x1f98('0x1f')];var _0x52966d=_0x2fc335?_0x547b5c[_0x1f98('0x1e')]:_0x1a21cd['offset']+_0x1a21cd[_0x1f98('0x1d')];var _0x23221d;if(_0x52966d>=_0x466bbd){_0x52966d=_0x466bbd;_0x23221d=0xc8;}else{_0x23221d=0xce;}_0x5d38ba[_0x1f98('0x19')](_0x23221d);return _0x5d38ba[_0x1f98('0x20')](_0x1f98('0x21'),_0x414268+'-'+_0x52966d+'/'+_0x466bbd)[_0x1f98('0x1b')](_0x547b5c);}return null;};}function patchUpdates(_0x21e416){return function(_0x3b9e54){try{jsonpatch[_0x1f98('0x22')](_0x3b9e54,_0x21e416,!![]);}catch(_0x56f46c){return BPromise['reject'](_0x56f46c);}return _0x3b9e54['save']();};}function saveUpdates(_0xa07804,_0x431958){return function(_0x46582d){if(_0x46582d){return _0x46582d['update'](_0xa07804)[_0x1f98('0x23')](function(_0x1b48d1){return _0x1b48d1;});}return null;};}function removeEntity(_0x5049d9,_0x55d29e){return function(_0x1de1cd){if(_0x1de1cd){return _0x1de1cd['destroy']()[_0x1f98('0x23')](function(){var _0x5a6f37=_0x1de1cd['get']({'plain':!![]});var _0x48a5dc=_0x1f98('0x24');return db['UserProfileResource'][_0x1f98('0x25')]({'where':{'type':_0x48a5dc,'resourceId':_0x5a6f37['id']}})[_0x1f98('0x23')](function(){return _0x1de1cd;});})[_0x1f98('0x23')](function(){_0x5049d9[_0x1f98('0x19')](0xcc)[_0x1f98('0x1a')]();});}};}function handleEntityNotFound(_0x3e1c19,_0x401606){return function(_0x1721fc){if(!_0x1721fc){_0x3e1c19['sendStatus'](0x194);}return _0x1721fc;};}function handleError(_0x10069b,_0x4aef13){_0x4aef13=_0x4aef13||0x1f4;return function(_0x18d13b){logger[_0x1f98('0x26')](_0x18d13b[_0x1f98('0x27')]);if(_0x18d13b[_0x1f98('0x28')]){delete _0x18d13b['name'];}_0x10069b['status'](_0x4aef13)[_0x1f98('0x29')](_0x18d13b);};}function getMustacheRender(_0x23ad11,_0x2df3fb){return Mustache[_0x1f98('0x2a')](_0x23ad11,_['merge'](_0x2df3fb[_0x1f98('0x2b')],{'contact':_0x2df3fb['contact'],'message':_0x2df3fb[_0x1f98('0x2c')],'agent':_0x2df3fb['agent'],'interaction':_0x2df3fb['interaction'],'account':_0x2df3fb[_0x1f98('0x2d')]}))||'';}exports[_0x1f98('0x2e')]=function(_0x474e74,_0x269aba){var _0x3e621c={},_0xb24ee6={},_0x52fae2={'count':0x0,'rows':[]};var _0x36f2fe=_[_0x1f98('0x2f')](db[_0x1f98('0x30')][_0x1f98('0x31')],function(_0x1f157f){return{'name':_0x1f157f[_0x1f98('0x32')],'type':_0x1f157f[_0x1f98('0x33')][_0x1f98('0x34')]};});_0xb24ee6[_0x1f98('0x35')]=_[_0x1f98('0x2f')](_0x36f2fe,_0x1f98('0x28'));_0xb24ee6[_0x1f98('0x36')]=_[_0x1f98('0x37')](_0x474e74[_0x1f98('0x36')]);_0xb24ee6[_0x1f98('0x38')]=_[_0x1f98('0x39')](_0xb24ee6[_0x1f98('0x35')],_0xb24ee6[_0x1f98('0x36')]);_0x3e621c['attributes']=_['intersection'](_0xb24ee6[_0x1f98('0x35')],qs['fields'](_0x474e74[_0x1f98('0x36')]['fields']));_0x3e621c[_0x1f98('0x3a')]=_0x3e621c[_0x1f98('0x3a')][_0x1f98('0x3b')]?_0x3e621c[_0x1f98('0x3a')]:_0xb24ee6[_0x1f98('0x35')];if(!_0x474e74[_0x1f98('0x36')]['hasOwnProperty'](_0x1f98('0x3c'))){_0x3e621c['limit']=qs['limit'](_0x474e74[_0x1f98('0x36')][_0x1f98('0x1d')]);_0x3e621c[_0x1f98('0x1f')]=qs[_0x1f98('0x1f')](_0x474e74[_0x1f98('0x36')]['offset']);}_0x3e621c[_0x1f98('0x3d')]=qs[_0x1f98('0x3e')](_0x474e74[_0x1f98('0x36')][_0x1f98('0x3e')]);_0x3e621c[_0x1f98('0x3f')]=qs[_0x1f98('0x38')](_[_0x1f98('0x40')](_0x474e74[_0x1f98('0x36')],_0xb24ee6['filters']),_0x36f2fe);if(_0x474e74[_0x1f98('0x36')][_0x1f98('0x41')]){_0x3e621c[_0x1f98('0x3f')]=_[_0x1f98('0x42')](_0x3e621c['where'],{'$or':_['map'](_0x36f2fe,function(_0x26683c){if(_0x26683c['type']!==_0x1f98('0x43')){var _0x9db84={};_0x9db84[_0x26683c[_0x1f98('0x28')]]={'$like':'%'+_0x474e74[_0x1f98('0x36')]['filter']+'%'};return _0x9db84;}})});}_0x3e621c=_['merge']({},_0x3e621c,_0x474e74['options']);var _0x1598c3={'where':_0x3e621c[_0x1f98('0x3f')]};return db[_0x1f98('0x30')][_0x1f98('0x1e')](_0x1598c3)[_0x1f98('0x23')](function(_0x4f9a42){_0x52fae2[_0x1f98('0x1e')]=_0x4f9a42;if(_0x474e74[_0x1f98('0x36')][_0x1f98('0x44')]){_0x3e621c[_0x1f98('0x45')]=[{'all':!![]}];}return db[_0x1f98('0x30')]['findAll'](_0x3e621c);})[_0x1f98('0x23')](function(_0x2ffc47){_0x52fae2[_0x1f98('0x46')]=_0x2ffc47;return _0x52fae2;})[_0x1f98('0x23')](respondWithFilteredResult(_0x269aba,_0x3e621c))['catch'](handleError(_0x269aba,null));};exports['show']=function(_0x160e06,_0x3e7fc0){var _0x19936a={'raw':!![],'where':{'id':_0x160e06[_0x1f98('0x47')]['id']}},_0x408a51={};_0x408a51[_0x1f98('0x35')]=_['keys'](db[_0x1f98('0x30')][_0x1f98('0x31')]);_0x408a51[_0x1f98('0x36')]=_[_0x1f98('0x37')](_0x160e06['query']);_0x408a51[_0x1f98('0x38')]=_[_0x1f98('0x39')](_0x408a51[_0x1f98('0x35')],_0x408a51['query']);_0x19936a[_0x1f98('0x3a')]=_[_0x1f98('0x39')](_0x408a51[_0x1f98('0x35')],qs[_0x1f98('0x48')](_0x160e06[_0x1f98('0x36')][_0x1f98('0x48')]));_0x19936a['attributes']=_0x19936a[_0x1f98('0x3a')][_0x1f98('0x3b')]?_0x19936a['attributes']:_0x408a51[_0x1f98('0x35')];if(_0x160e06[_0x1f98('0x36')][_0x1f98('0x44')]){_0x19936a[_0x1f98('0x45')]=[{'all':!![]}];}_0x19936a=_['merge']({},_0x19936a,_0x160e06['options']);return db[_0x1f98('0x30')][_0x1f98('0x49')](_0x19936a)[_0x1f98('0x23')](handleEntityNotFound(_0x3e7fc0,null))[_0x1f98('0x23')](respondWithResult(_0x3e7fc0,null))[_0x1f98('0x4a')](handleError(_0x3e7fc0,null));};exports[_0x1f98('0x4b')]=function(_0x4af13c,_0x5ec2d4){return db[_0x1f98('0x30')]['create'](_0x4af13c[_0x1f98('0x2b')],{})[_0x1f98('0x23')](function(_0x5dbc76){var _0x320ad6=_0x4af13c[_0x1f98('0x4c')][_0x1f98('0x4d')]({'plain':!![]});if(!_0x320ad6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x320ad6[_0x1f98('0x4e')]===_0x1f98('0x4c')){var _0x3bc5ad=_0x5dbc76[_0x1f98('0x4d')]({'plain':!![]});var _0x5de9dc=_0x1f98('0x24');return db['UserProfileSection'][_0x1f98('0x49')]({'where':{'name':_0x5de9dc,'userProfileId':_0x320ad6['userProfileId']},'raw':!![]})[_0x1f98('0x23')](function(_0x82183a){if(_0x82183a&&_0x82183a[_0x1f98('0x4f')]===0x0){return db[_0x1f98('0x50')][_0x1f98('0x4b')]({'name':_0x3bc5ad['name'],'resourceId':_0x3bc5ad['id'],'type':_0x82183a['name'],'sectionId':_0x82183a['id']},{})[_0x1f98('0x23')](function(){return _0x5dbc76;});}else{return _0x5dbc76;}})['catch'](function(_0xb1d0e){logger['error'](_0x1f98('0x51'),_0xb1d0e);throw _0xb1d0e;});}return _0x5dbc76;})[_0x1f98('0x23')](respondWithResult(_0x5ec2d4,0xc9))[_0x1f98('0x4a')](handleError(_0x5ec2d4,null));};exports[_0x1f98('0x52')]=function(_0x1fc4d6,_0xcdb24e){if(_0x1fc4d6[_0x1f98('0x2b')]['id']){delete _0x1fc4d6[_0x1f98('0x2b')]['id'];}return db[_0x1f98('0x30')][_0x1f98('0x49')]({'where':{'id':_0x1fc4d6[_0x1f98('0x47')]['id']}})[_0x1f98('0x23')](handleEntityNotFound(_0xcdb24e,null))['then'](saveUpdates(_0x1fc4d6['body'],null))[_0x1f98('0x23')](respondWithResult(_0xcdb24e,null))['catch'](handleError(_0xcdb24e,null));};exports[_0x1f98('0x25')]=function(_0x356148,_0x533c06){return db['Variable'][_0x1f98('0x49')]({'where':{'id':_0x356148[_0x1f98('0x47')]['id']}})['then'](handleEntityNotFound(_0x533c06,null))['then'](removeEntity(_0x533c06,null))[_0x1f98('0x4a')](handleError(_0x533c06,null));};
\ No newline at end of file
+var _0x7f05=['reject','update','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','Variable','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','show','find','catch','create','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0x7f05,0xdc));var _0x57f0=function(_0x1ab7a5,_0xec8b18){_0x1ab7a5=_0x1ab7a5-0x0;var _0x13484f=_0x7f05[_0x1ab7a5];return _0x13484f;};'use strict';var emlformat=require(_0x57f0('0x0'));var rimraf=require(_0x57f0('0x1'));var zipdir=require(_0x57f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57f0('0x3'));var moment=require('moment');var BPromise=require(_0x57f0('0x4'));var Mustache=require(_0x57f0('0x5'));var util=require('util');var path=require(_0x57f0('0x6'));var sox=require(_0x57f0('0x7'));var csv=require('to-csv');var ejs=require(_0x57f0('0x8'));var fs=require('fs');var fs_extra=require(_0x57f0('0x9'));var _=require('lodash');var squel=require(_0x57f0('0xa'));var crypto=require(_0x57f0('0xb'));var jsforce=require(_0x57f0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x57f0('0xe'));var authService=require(_0x57f0('0xf'));var qs=require(_0x57f0('0x10'));var as=require(_0x57f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x57f0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd266,_0x5615ff){_0x5615ff=_0x5615ff||0xcc;return function(_0x1aa9c8){if(_0x1aa9c8){return _0x5cd266[_0x57f0('0x13')](_0x5615ff);}return _0x5cd266[_0x57f0('0x14')](_0x5615ff)[_0x57f0('0x15')]();};}function respondWithResult(_0x599a6b,_0x4d8d89){_0x4d8d89=_0x4d8d89||0xc8;return function(_0x471f97){if(_0x471f97){return _0x599a6b[_0x57f0('0x14')](_0x4d8d89)[_0x57f0('0x16')](_0x471f97);}};}function respondWithFilteredResult(_0x2e57df,_0x238245){return function(_0x2130ca){if(_0x2130ca){var _0x555e18=typeof _0x238245['offset']===_0x57f0('0x17')&&typeof _0x238245['limit']==='undefined';var _0x48eadd=_0x2130ca['count'];var _0x20d0ba=_0x555e18?0x0:_0x238245[_0x57f0('0x18')];var _0x124f9e=_0x555e18?_0x2130ca['count']:_0x238245[_0x57f0('0x18')]+_0x238245[_0x57f0('0x19')];var _0x3d0cf6;if(_0x124f9e>=_0x48eadd){_0x124f9e=_0x48eadd;_0x3d0cf6=0xc8;}else{_0x3d0cf6=0xce;}_0x2e57df['status'](_0x3d0cf6);return _0x2e57df[_0x57f0('0x1a')](_0x57f0('0x1b'),_0x20d0ba+'-'+_0x124f9e+'/'+_0x48eadd)['json'](_0x2130ca);}return null;};}function patchUpdates(_0x589c18){return function(_0x1f8483){try{jsonpatch[_0x57f0('0x1c')](_0x1f8483,_0x589c18,!![]);}catch(_0x599aa2){return BPromise[_0x57f0('0x1d')](_0x599aa2);}return _0x1f8483['save']();};}function saveUpdates(_0x3a5b6f,_0x9c498){return function(_0x426a09){if(_0x426a09){return _0x426a09[_0x57f0('0x1e')](_0x3a5b6f)['then'](function(_0x5d16a6){return _0x5d16a6;});}return null;};}function removeEntity(_0x43a679,_0x56ceb5){return function(_0x1279ae){if(_0x1279ae){return _0x1279ae[_0x57f0('0x1f')]()[_0x57f0('0x20')](function(){var _0x3f5d1e=_0x1279ae[_0x57f0('0x21')]({'plain':!![]});var _0x1c2cae=_0x57f0('0x22');return db[_0x57f0('0x23')]['destroy']({'where':{'type':_0x1c2cae,'resourceId':_0x3f5d1e['id']}})[_0x57f0('0x20')](function(){return _0x1279ae;});})['then'](function(){_0x43a679['status'](0xcc)[_0x57f0('0x15')]();});}};}function handleEntityNotFound(_0x58a529,_0x407829){return function(_0x50347e){if(!_0x50347e){_0x58a529['sendStatus'](0x194);}return _0x50347e;};}function handleError(_0x23564f,_0x1fd10){_0x1fd10=_0x1fd10||0x1f4;return function(_0x16c711){logger[_0x57f0('0x24')](_0x16c711[_0x57f0('0x25')]);if(_0x16c711[_0x57f0('0x26')]){delete _0x16c711[_0x57f0('0x26')];}_0x23564f[_0x57f0('0x14')](_0x1fd10)[_0x57f0('0x27')](_0x16c711);};}function getMustacheRender(_0x41ef0f,_0x5c7095){return Mustache[_0x57f0('0x28')](_0x41ef0f,_[_0x57f0('0x29')](_0x5c7095[_0x57f0('0x2a')],{'contact':_0x5c7095[_0x57f0('0x2b')],'message':_0x5c7095[_0x57f0('0x2c')],'agent':_0x5c7095[_0x57f0('0x2d')],'interaction':_0x5c7095[_0x57f0('0x2e')],'account':_0x5c7095[_0x57f0('0x2f')]}))||'';}exports[_0x57f0('0x30')]=function(_0x12da92,_0x2c13cf){var _0x249557={},_0x12fb54={},_0x3a8e5f={'count':0x0,'rows':[]};var _0x559440=_[_0x57f0('0x31')](db[_0x57f0('0x32')][_0x57f0('0x33')],function(_0x3751d7){return{'name':_0x3751d7['fieldName'],'type':_0x3751d7['type']['key']};});_0x12fb54[_0x57f0('0x34')]=_['map'](_0x559440,_0x57f0('0x26'));_0x12fb54[_0x57f0('0x35')]=_[_0x57f0('0x36')](_0x12da92['query']);_0x12fb54[_0x57f0('0x37')]=_[_0x57f0('0x38')](_0x12fb54[_0x57f0('0x34')],_0x12fb54[_0x57f0('0x35')]);_0x249557[_0x57f0('0x39')]=_[_0x57f0('0x38')](_0x12fb54[_0x57f0('0x34')],qs[_0x57f0('0x3a')](_0x12da92[_0x57f0('0x35')][_0x57f0('0x3a')]));_0x249557[_0x57f0('0x39')]=_0x249557[_0x57f0('0x39')][_0x57f0('0x3b')]?_0x249557[_0x57f0('0x39')]:_0x12fb54[_0x57f0('0x34')];if(!_0x12da92[_0x57f0('0x35')][_0x57f0('0x3c')](_0x57f0('0x3d'))){_0x249557[_0x57f0('0x19')]=qs['limit'](_0x12da92['query'][_0x57f0('0x19')]);_0x249557[_0x57f0('0x18')]=qs[_0x57f0('0x18')](_0x12da92['query'][_0x57f0('0x18')]);}_0x249557[_0x57f0('0x3e')]=qs[_0x57f0('0x3f')](_0x12da92[_0x57f0('0x35')][_0x57f0('0x3f')]);_0x249557[_0x57f0('0x40')]=qs[_0x57f0('0x37')](_[_0x57f0('0x41')](_0x12da92[_0x57f0('0x35')],_0x12fb54['filters']),_0x559440);if(_0x12da92[_0x57f0('0x35')][_0x57f0('0x42')]){_0x249557[_0x57f0('0x40')]=_[_0x57f0('0x29')](_0x249557['where'],{'$or':_[_0x57f0('0x31')](_0x559440,function(_0x1d1dd5){if(_0x1d1dd5['type']!==_0x57f0('0x43')){var _0x46525c={};_0x46525c[_0x1d1dd5[_0x57f0('0x26')]]={'$like':'%'+_0x12da92[_0x57f0('0x35')][_0x57f0('0x42')]+'%'};return _0x46525c;}})});}_0x249557=_[_0x57f0('0x29')]({},_0x249557,_0x12da92[_0x57f0('0x44')]);var _0x4f3271={'where':_0x249557[_0x57f0('0x40')]};return db['Variable'][_0x57f0('0x45')](_0x4f3271)['then'](function(_0x116c5a){_0x3a8e5f[_0x57f0('0x45')]=_0x116c5a;if(_0x12da92[_0x57f0('0x35')][_0x57f0('0x46')]){_0x249557[_0x57f0('0x47')]=[{'all':!![]}];}return db[_0x57f0('0x32')][_0x57f0('0x48')](_0x249557);})[_0x57f0('0x20')](function(_0x3f89af){_0x3a8e5f[_0x57f0('0x49')]=_0x3f89af;return _0x3a8e5f;})[_0x57f0('0x20')](respondWithFilteredResult(_0x2c13cf,_0x249557))['catch'](handleError(_0x2c13cf,null));};exports[_0x57f0('0x4a')]=function(_0x45c6f7,_0x59b4eb){var _0x490ea2={'raw':!![],'where':{'id':_0x45c6f7['params']['id']}},_0x382a8a={};_0x382a8a[_0x57f0('0x34')]=_[_0x57f0('0x36')](db[_0x57f0('0x32')]['rawAttributes']);_0x382a8a[_0x57f0('0x35')]=_[_0x57f0('0x36')](_0x45c6f7['query']);_0x382a8a[_0x57f0('0x37')]=_[_0x57f0('0x38')](_0x382a8a[_0x57f0('0x34')],_0x382a8a[_0x57f0('0x35')]);_0x490ea2[_0x57f0('0x39')]=_[_0x57f0('0x38')](_0x382a8a['model'],qs[_0x57f0('0x3a')](_0x45c6f7[_0x57f0('0x35')]['fields']));_0x490ea2[_0x57f0('0x39')]=_0x490ea2['attributes'][_0x57f0('0x3b')]?_0x490ea2['attributes']:_0x382a8a[_0x57f0('0x34')];if(_0x45c6f7['query']['includeAll']){_0x490ea2[_0x57f0('0x47')]=[{'all':!![]}];}_0x490ea2=_[_0x57f0('0x29')]({},_0x490ea2,_0x45c6f7[_0x57f0('0x44')]);return db['Variable'][_0x57f0('0x4b')](_0x490ea2)[_0x57f0('0x20')](handleEntityNotFound(_0x59b4eb,null))[_0x57f0('0x20')](respondWithResult(_0x59b4eb,null))[_0x57f0('0x4c')](handleError(_0x59b4eb,null));};exports[_0x57f0('0x4d')]=function(_0x3349fa,_0xced2ac){return db[_0x57f0('0x32')][_0x57f0('0x4d')](_0x3349fa['body'],{})[_0x57f0('0x20')](function(_0x3515e3){var _0x5a2a7b=_0x3349fa[_0x57f0('0x4e')][_0x57f0('0x21')]({'plain':!![]});if(!_0x5a2a7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a2a7b['role']===_0x57f0('0x4e')){var _0x71081b=_0x3515e3['get']({'plain':!![]});var _0x5d6138='Variables';return db[_0x57f0('0x4f')][_0x57f0('0x4b')]({'where':{'name':_0x5d6138,'userProfileId':_0x5a2a7b['userProfileId']},'raw':!![]})[_0x57f0('0x20')](function(_0x4f4fe9){if(_0x4f4fe9&&_0x4f4fe9[_0x57f0('0x50')]===0x0){return db[_0x57f0('0x23')]['create']({'name':_0x71081b[_0x57f0('0x26')],'resourceId':_0x71081b['id'],'type':_0x4f4fe9[_0x57f0('0x26')],'sectionId':_0x4f4fe9['id']},{})['then'](function(){return _0x3515e3;});}else{return _0x3515e3;}})[_0x57f0('0x4c')](function(_0x22e2d2){logger['error'](_0x57f0('0x51'),_0x22e2d2);throw _0x22e2d2;});}return _0x3515e3;})[_0x57f0('0x20')](respondWithResult(_0xced2ac,0xc9))[_0x57f0('0x4c')](handleError(_0xced2ac,null));};exports['update']=function(_0x40edee,_0x429469){if(_0x40edee[_0x57f0('0x2a')]['id']){delete _0x40edee['body']['id'];}return db[_0x57f0('0x32')][_0x57f0('0x4b')]({'where':{'id':_0x40edee[_0x57f0('0x52')]['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x429469,null))[_0x57f0('0x20')](saveUpdates(_0x40edee[_0x57f0('0x2a')],null))[_0x57f0('0x20')](respondWithResult(_0x429469,null))[_0x57f0('0x4c')](handleError(_0x429469,null));};exports[_0x57f0('0x1f')]=function(_0x4af55b,_0x1f0d2c){return db[_0x57f0('0x32')][_0x57f0('0x4b')]({'where':{'id':_0x4af55b[_0x57f0('0x52')]['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x1f0d2c,null))[_0x57f0('0x20')](removeEntity(_0x1f0d2c,null))['catch'](handleError(_0x1f0d2c,null));};
\ No newline at end of file