Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / variable / variable.controller.js
index 42648ce..40e776b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c0a=['count','set','Content-Range','json','apply','reject','save','update','then','destroy','Variables','UserProfileResource','error','stack','name','index','map','type','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','filter','VIRTUAL','Variable','include','rows','catch','show','params','keys','length','includeAll','merge','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit'];(function(_0xdd7a7b,_0x254b3a){var _0x40ca7d=function(_0x4c2744){while(--_0x4c2744){_0xdd7a7b['push'](_0xdd7a7b['shift']());}};_0x40ca7d(++_0x254b3a);}(_0x4c0a,0x181));var _0xa4c0=function(_0x1b4c9d,_0x1b9e7b){_0x1b4c9d=_0x1b4c9d-0x0;var _0x2f75ac=_0x4c0a[_0x1b4c9d];return _0x2f75ac;};'use strict';var emlformat=require(_0xa4c0('0x0'));var rimraf=require(_0xa4c0('0x1'));var zipdir=require(_0xa4c0('0x2'));var jsonpatch=require(_0xa4c0('0x3'));var rp=require(_0xa4c0('0x4'));var moment=require(_0xa4c0('0x5'));var BPromise=require(_0xa4c0('0x6'));var Mustache=require(_0xa4c0('0x7'));var util=require(_0xa4c0('0x8'));var path=require('path');var sox=require(_0xa4c0('0x9'));var csv=require(_0xa4c0('0xa'));var ejs=require(_0xa4c0('0xb'));var fs=require('fs');var fs_extra=require(_0xa4c0('0xc'));var _=require(_0xa4c0('0xd'));var squel=require(_0xa4c0('0xe'));var crypto=require(_0xa4c0('0xf'));var jsforce=require(_0xa4c0('0x10'));var deskjs=require(_0xa4c0('0x11'));var toCsv=require(_0xa4c0('0xa'));var querystring=require(_0xa4c0('0x12'));var Papa=require(_0xa4c0('0x13'));var Redis=require(_0xa4c0('0x14'));var authService=require(_0xa4c0('0x15'));var qs=require(_0xa4c0('0x16'));var as=require(_0xa4c0('0x17'));var hardwareService=require(_0xa4c0('0x18'));var logger=require(_0xa4c0('0x19'))(_0xa4c0('0x1a'));var utils=require(_0xa4c0('0x1b'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa4c0('0x1c'))['db'];function respondWithStatusCode(_0x35263f,_0x40c819){_0x40c819=_0x40c819||0xcc;return function(_0x31c60a){if(_0x31c60a){return _0x35263f[_0xa4c0('0x1d')](_0x40c819);}return _0x35263f[_0xa4c0('0x1e')](_0x40c819)[_0xa4c0('0x1f')]();};}function respondWithResult(_0x4eef62,_0x251ccf){_0x251ccf=_0x251ccf||0xc8;return function(_0x918693){if(_0x918693){return _0x4eef62[_0xa4c0('0x1e')](_0x251ccf)['json'](_0x918693);}};}function respondWithFilteredResult(_0x440616,_0x3ba2c0){return function(_0x52e26b){if(_0x52e26b){var _0x19430f=typeof _0x3ba2c0[_0xa4c0('0x20')]===_0xa4c0('0x21')&&typeof _0x3ba2c0[_0xa4c0('0x22')]===_0xa4c0('0x21');var _0x277732=_0x52e26b[_0xa4c0('0x23')];var _0x34f8ef=_0x19430f?0x0:_0x3ba2c0['offset'];var _0x4dacc6=_0x19430f?_0x52e26b['count']:_0x3ba2c0[_0xa4c0('0x20')]+_0x3ba2c0[_0xa4c0('0x22')];var _0x4c57cb;if(_0x4dacc6>=_0x277732){_0x4dacc6=_0x277732;_0x4c57cb=0xc8;}else{_0x4c57cb=0xce;}_0x440616[_0xa4c0('0x1e')](_0x4c57cb);return _0x440616[_0xa4c0('0x24')](_0xa4c0('0x25'),_0x34f8ef+'-'+_0x4dacc6+'/'+_0x277732)[_0xa4c0('0x26')](_0x52e26b);}return null;};}function patchUpdates(_0x12b037){return function(_0x4dc1f7){try{jsonpatch[_0xa4c0('0x27')](_0x4dc1f7,_0x12b037,!![]);}catch(_0x33ba35){return BPromise[_0xa4c0('0x28')](_0x33ba35);}return _0x4dc1f7[_0xa4c0('0x29')]();};}function saveUpdates(_0x4f877b,_0xe59b24){return function(_0x4aed76){if(_0x4aed76){return _0x4aed76[_0xa4c0('0x2a')](_0x4f877b)[_0xa4c0('0x2b')](function(_0x514717){return _0x514717;});}return null;};}function removeEntity(_0x446a16,_0x29c8cf){return function(_0x1b672a){if(_0x1b672a){return _0x1b672a[_0xa4c0('0x2c')]()['then'](function(){var _0x1977b3=_0x1b672a['get']({'plain':!![]});var _0xe729e7=_0xa4c0('0x2d');return db[_0xa4c0('0x2e')][_0xa4c0('0x2c')]({'where':{'type':_0xe729e7,'resourceId':_0x1977b3['id']}})[_0xa4c0('0x2b')](function(){return _0x1b672a;});})['then'](function(){_0x446a16[_0xa4c0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ad2b,_0x61c726){return function(_0x2dd2ae){if(!_0x2dd2ae){_0x39ad2b[_0xa4c0('0x1d')](0x194);}return _0x2dd2ae;};}function handleError(_0x3d37d2,_0x245cf5){_0x245cf5=_0x245cf5||0x1f4;return function(_0x412ee3){logger[_0xa4c0('0x2f')](_0x412ee3[_0xa4c0('0x30')]);if(_0x412ee3['name']){delete _0x412ee3[_0xa4c0('0x31')];}_0x3d37d2[_0xa4c0('0x1e')](_0x245cf5)['send'](_0x412ee3);};}exports[_0xa4c0('0x32')]=function(_0x5904f2,_0x1f659a){var _0x5a2ebe={},_0x5b572e={},_0x5b68d5={'count':0x0,'rows':[]};var _0x541819=_[_0xa4c0('0x33')](db['Variable']['rawAttributes'],function(_0x25398b){return{'name':_0x25398b['fieldName'],'type':_0x25398b[_0xa4c0('0x34')][_0xa4c0('0x35')]};});_0x5b572e[_0xa4c0('0x36')]=_[_0xa4c0('0x33')](_0x541819,_0xa4c0('0x31'));_0x5b572e['query']=_['keys'](_0x5904f2[_0xa4c0('0x37')]);_0x5b572e['filters']=_[_0xa4c0('0x38')](_0x5b572e[_0xa4c0('0x36')],_0x5b572e['query']);_0x5a2ebe[_0xa4c0('0x39')]=_['intersection'](_0x5b572e[_0xa4c0('0x36')],qs['fields'](_0x5904f2['query'][_0xa4c0('0x3a')]));_0x5a2ebe[_0xa4c0('0x39')]=_0x5a2ebe[_0xa4c0('0x39')]['length']?_0x5a2ebe[_0xa4c0('0x39')]:_0x5b572e[_0xa4c0('0x36')];if(!_0x5904f2[_0xa4c0('0x37')][_0xa4c0('0x3b')]('nolimit')){_0x5a2ebe[_0xa4c0('0x22')]=qs['limit'](_0x5904f2[_0xa4c0('0x37')][_0xa4c0('0x22')]);_0x5a2ebe['offset']=qs[_0xa4c0('0x20')](_0x5904f2[_0xa4c0('0x37')]['offset']);}_0x5a2ebe['order']=qs[_0xa4c0('0x3c')](_0x5904f2[_0xa4c0('0x37')][_0xa4c0('0x3c')]);_0x5a2ebe[_0xa4c0('0x3d')]=qs[_0xa4c0('0x3e')](_['pick'](_0x5904f2['query'],_0x5b572e[_0xa4c0('0x3e')]),_0x541819);if(_0x5904f2[_0xa4c0('0x37')][_0xa4c0('0x3f')]){_0x5a2ebe['where']=_['merge'](_0x5a2ebe[_0xa4c0('0x3d')],{'$or':_[_0xa4c0('0x33')](_0x541819,function(_0x4dd8cf){if(_0x4dd8cf[_0xa4c0('0x34')]!==_0xa4c0('0x40')){var _0x2eeab9={};_0x2eeab9[_0x4dd8cf[_0xa4c0('0x31')]]={'$like':'%'+_0x5904f2['query'][_0xa4c0('0x3f')]+'%'};return _0x2eeab9;}})});}_0x5a2ebe=_['merge']({},_0x5a2ebe,_0x5904f2['options']);var _0x349c7a={'where':_0x5a2ebe[_0xa4c0('0x3d')]};return db[_0xa4c0('0x41')][_0xa4c0('0x23')](_0x349c7a)['then'](function(_0xeb4456){_0x5b68d5['count']=_0xeb4456;if(_0x5904f2['query']['includeAll']){_0x5a2ebe[_0xa4c0('0x42')]=[{'all':!![]}];}return db[_0xa4c0('0x41')]['findAll'](_0x5a2ebe);})[_0xa4c0('0x2b')](function(_0x50e0d8){_0x5b68d5[_0xa4c0('0x43')]=_0x50e0d8;return _0x5b68d5;})[_0xa4c0('0x2b')](respondWithFilteredResult(_0x1f659a,_0x5a2ebe))[_0xa4c0('0x44')](handleError(_0x1f659a,null));};exports[_0xa4c0('0x45')]=function(_0x240ca4,_0x3177f2){var _0x1506d0={'raw':!![],'where':{'id':_0x240ca4[_0xa4c0('0x46')]['id']}},_0x48ebab={};_0x48ebab[_0xa4c0('0x36')]=_[_0xa4c0('0x47')](db['Variable']['rawAttributes']);_0x48ebab['query']=_[_0xa4c0('0x47')](_0x240ca4[_0xa4c0('0x37')]);_0x48ebab[_0xa4c0('0x3e')]=_['intersection'](_0x48ebab[_0xa4c0('0x36')],_0x48ebab[_0xa4c0('0x37')]);_0x1506d0[_0xa4c0('0x39')]=_['intersection'](_0x48ebab[_0xa4c0('0x36')],qs[_0xa4c0('0x3a')](_0x240ca4[_0xa4c0('0x37')][_0xa4c0('0x3a')]));_0x1506d0[_0xa4c0('0x39')]=_0x1506d0[_0xa4c0('0x39')][_0xa4c0('0x48')]?_0x1506d0['attributes']:_0x48ebab[_0xa4c0('0x36')];if(_0x240ca4['query'][_0xa4c0('0x49')]){_0x1506d0[_0xa4c0('0x42')]=[{'all':!![]}];}_0x1506d0=_[_0xa4c0('0x4a')]({},_0x1506d0,_0x240ca4['options']);return db[_0xa4c0('0x41')][_0xa4c0('0x4b')](_0x1506d0)[_0xa4c0('0x2b')](handleEntityNotFound(_0x3177f2,null))[_0xa4c0('0x2b')](respondWithResult(_0x3177f2,null))['catch'](handleError(_0x3177f2,null));};exports['create']=function(_0x3f8ca6,_0x4b5b91){return db['Variable']['create'](_0x3f8ca6[_0xa4c0('0x4c')],{})[_0xa4c0('0x2b')](function(_0x500c6e){var _0x31ee1b=_0x3f8ca6[_0xa4c0('0x4d')]['get']({'plain':!![]});if(!_0x31ee1b)throw new Error(_0xa4c0('0x4e'));if(_0x31ee1b[_0xa4c0('0x4f')]===_0xa4c0('0x4d')){var _0xff5e84=_0x500c6e[_0xa4c0('0x50')]({'plain':!![]});var _0x900908=_0xa4c0('0x2d');return db[_0xa4c0('0x51')][_0xa4c0('0x4b')]({'where':{'name':_0x900908,'userProfileId':_0x31ee1b[_0xa4c0('0x52')]},'raw':!![]})[_0xa4c0('0x2b')](function(_0x1da664){if(_0x1da664&&_0x1da664['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xff5e84[_0xa4c0('0x31')],'resourceId':_0xff5e84['id'],'type':_0x1da664[_0xa4c0('0x31')],'sectionId':_0x1da664['id']},{})[_0xa4c0('0x2b')](function(){return _0x500c6e;});}else{return _0x500c6e;}})[_0xa4c0('0x44')](function(_0x26f9db){logger['error'](_0xa4c0('0x53'),_0x26f9db);throw _0x26f9db;});}return _0x500c6e;})[_0xa4c0('0x2b')](respondWithResult(_0x4b5b91,0xc9))[_0xa4c0('0x44')](handleError(_0x4b5b91,null));};exports[_0xa4c0('0x2a')]=function(_0x50db44,_0x229a59){if(_0x50db44[_0xa4c0('0x4c')]['id']){delete _0x50db44[_0xa4c0('0x4c')]['id'];}return db['Variable'][_0xa4c0('0x4b')]({'where':{'id':_0x50db44['params']['id']}})[_0xa4c0('0x2b')](handleEntityNotFound(_0x229a59,null))[_0xa4c0('0x2b')](saveUpdates(_0x50db44[_0xa4c0('0x4c')],null))[_0xa4c0('0x2b')](respondWithResult(_0x229a59,null))[_0xa4c0('0x44')](handleError(_0x229a59,null));};exports['destroy']=function(_0x5a0441,_0x494a76){return db['Variable']['find']({'where':{'id':_0x5a0441[_0xa4c0('0x46')]['id']}})[_0xa4c0('0x2b')](handleEntityNotFound(_0x494a76,null))['then'](removeEntity(_0x494a76,null))[_0xa4c0('0x44')](handleError(_0x494a76,null));};
\ No newline at end of file
+var _0x71f7=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Variable','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','rawAttributes','type','key','map','query','intersection','model','attributes'];(function(_0x574de7,_0x24ce60){var _0x568f46=function(_0x516004){while(--_0x516004){_0x574de7['push'](_0x574de7['shift']());}};_0x568f46(++_0x24ce60);}(_0x71f7,0x6a));var _0x771f=function(_0x3be286,_0x42a0f6){_0x3be286=_0x3be286-0x0;var _0x529393=_0x71f7[_0x3be286];return _0x529393;};'use strict';var emlformat=require(_0x771f('0x0'));var rimraf=require(_0x771f('0x1'));var zipdir=require(_0x771f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x771f('0x3'));var BPromise=require(_0x771f('0x4'));var Mustache=require(_0x771f('0x5'));var util=require(_0x771f('0x6'));var path=require(_0x771f('0x7'));var sox=require('sox');var csv=require(_0x771f('0x8'));var ejs=require(_0x771f('0x9'));var fs=require('fs');var fs_extra=require(_0x771f('0xa'));var _=require(_0x771f('0xb'));var squel=require(_0x771f('0xc'));var crypto=require(_0x771f('0xd'));var jsforce=require(_0x771f('0xe'));var deskjs=require(_0x771f('0xf'));var toCsv=require(_0x771f('0x8'));var querystring=require(_0x771f('0x10'));var Papa=require('papaparse');var Redis=require(_0x771f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x771f('0x12'));var hardwareService=require(_0x771f('0x13'));var logger=require('../../config/logger')(_0x771f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x771f('0x15'))['db'];function respondWithStatusCode(_0x5964b7,_0x1073b8){_0x1073b8=_0x1073b8||0xcc;return function(_0x14ac7d){if(_0x14ac7d){return _0x5964b7[_0x771f('0x16')](_0x1073b8);}return _0x5964b7[_0x771f('0x17')](_0x1073b8)[_0x771f('0x18')]();};}function respondWithResult(_0x4bbcae,_0x295dad){_0x295dad=_0x295dad||0xc8;return function(_0x33b371){if(_0x33b371){return _0x4bbcae[_0x771f('0x17')](_0x295dad)[_0x771f('0x19')](_0x33b371);}};}function respondWithFilteredResult(_0x4ca19e,_0x1aa0bc){return function(_0x36ecc3){if(_0x36ecc3){var _0x4c92bd=typeof _0x1aa0bc[_0x771f('0x1a')]===_0x771f('0x1b')&&typeof _0x1aa0bc['limit']===_0x771f('0x1b');var _0x1457b5=_0x36ecc3[_0x771f('0x1c')];var _0x10f061=_0x4c92bd?0x0:_0x1aa0bc['offset'];var _0x3996cc=_0x4c92bd?_0x36ecc3[_0x771f('0x1c')]:_0x1aa0bc[_0x771f('0x1a')]+_0x1aa0bc[_0x771f('0x1d')];var _0x21aaf5;if(_0x3996cc>=_0x1457b5){_0x3996cc=_0x1457b5;_0x21aaf5=0xc8;}else{_0x21aaf5=0xce;}_0x4ca19e[_0x771f('0x17')](_0x21aaf5);return _0x4ca19e['set'](_0x771f('0x1e'),_0x10f061+'-'+_0x3996cc+'/'+_0x1457b5)[_0x771f('0x19')](_0x36ecc3);}return null;};}function patchUpdates(_0x1bf45f){return function(_0x15deee){try{jsonpatch[_0x771f('0x1f')](_0x15deee,_0x1bf45f,!![]);}catch(_0x52e7f0){return BPromise['reject'](_0x52e7f0);}return _0x15deee[_0x771f('0x20')]();};}function saveUpdates(_0x14c5ee,_0x3f9f42){return function(_0x4ade73){if(_0x4ade73){return _0x4ade73[_0x771f('0x21')](_0x14c5ee)[_0x771f('0x22')](function(_0x1f2b47){return _0x1f2b47;});}return null;};}function removeEntity(_0x4a2b53,_0x416bd1){return function(_0xe03af5){if(_0xe03af5){return _0xe03af5['destroy']()[_0x771f('0x22')](function(){var _0x48e936=_0xe03af5[_0x771f('0x23')]({'plain':!![]});var _0x381d38=_0x771f('0x24');return db[_0x771f('0x25')][_0x771f('0x26')]({'where':{'type':_0x381d38,'resourceId':_0x48e936['id']}})[_0x771f('0x22')](function(){return _0xe03af5;});})[_0x771f('0x22')](function(){_0x4a2b53[_0x771f('0x17')](0xcc)[_0x771f('0x18')]();});}};}function handleEntityNotFound(_0x2e8d46,_0x74d370){return function(_0x30c94b){if(!_0x30c94b){_0x2e8d46[_0x771f('0x16')](0x194);}return _0x30c94b;};}function handleError(_0x8ded7b,_0x270cab){_0x270cab=_0x270cab||0x1f4;return function(_0x1c96e1){logger[_0x771f('0x27')](_0x1c96e1[_0x771f('0x28')]);if(_0x1c96e1[_0x771f('0x29')]){delete _0x1c96e1[_0x771f('0x29')];}_0x8ded7b['status'](_0x270cab)['send'](_0x1c96e1);};}exports['index']=function(_0x413572,_0x249f0f){var _0x4650a7={},_0x341c5d={},_0x1ed525={'count':0x0,'rows':[]};var _0xb58a5b=_['map'](db['Variable'][_0x771f('0x2a')],function(_0x2402a5){return{'name':_0x2402a5['fieldName'],'type':_0x2402a5[_0x771f('0x2b')][_0x771f('0x2c')]};});_0x341c5d['model']=_[_0x771f('0x2d')](_0xb58a5b,_0x771f('0x29'));_0x341c5d['query']=_['keys'](_0x413572[_0x771f('0x2e')]);_0x341c5d['filters']=_[_0x771f('0x2f')](_0x341c5d[_0x771f('0x30')],_0x341c5d[_0x771f('0x2e')]);_0x4650a7[_0x771f('0x31')]=_['intersection'](_0x341c5d[_0x771f('0x30')],qs[_0x771f('0x32')](_0x413572['query']['fields']));_0x4650a7[_0x771f('0x31')]=_0x4650a7[_0x771f('0x31')][_0x771f('0x33')]?_0x4650a7[_0x771f('0x31')]:_0x341c5d[_0x771f('0x30')];if(!_0x413572[_0x771f('0x2e')][_0x771f('0x34')](_0x771f('0x35'))){_0x4650a7['limit']=qs['limit'](_0x413572[_0x771f('0x2e')]['limit']);_0x4650a7[_0x771f('0x1a')]=qs[_0x771f('0x1a')](_0x413572[_0x771f('0x2e')][_0x771f('0x1a')]);}_0x4650a7[_0x771f('0x36')]=qs[_0x771f('0x37')](_0x413572[_0x771f('0x2e')][_0x771f('0x37')]);_0x4650a7[_0x771f('0x38')]=qs[_0x771f('0x39')](_['pick'](_0x413572[_0x771f('0x2e')],_0x341c5d['filters']),_0xb58a5b);if(_0x413572[_0x771f('0x2e')][_0x771f('0x3a')]){_0x4650a7['where']=_[_0x771f('0x3b')](_0x4650a7[_0x771f('0x38')],{'$or':_[_0x771f('0x2d')](_0xb58a5b,function(_0x2bfb3d){if(_0x2bfb3d[_0x771f('0x2b')]!==_0x771f('0x3c')){var _0x3963c5={};_0x3963c5[_0x2bfb3d[_0x771f('0x29')]]={'$like':'%'+_0x413572[_0x771f('0x2e')][_0x771f('0x3a')]+'%'};return _0x3963c5;}})});}_0x4650a7=_[_0x771f('0x3b')]({},_0x4650a7,_0x413572[_0x771f('0x3d')]);var _0x3323fe={'where':_0x4650a7[_0x771f('0x38')]};return db[_0x771f('0x3e')][_0x771f('0x1c')](_0x3323fe)[_0x771f('0x22')](function(_0x58e141){_0x1ed525['count']=_0x58e141;if(_0x413572['query'][_0x771f('0x3f')]){_0x4650a7[_0x771f('0x40')]=[{'all':!![]}];}return db[_0x771f('0x3e')][_0x771f('0x41')](_0x4650a7);})['then'](function(_0x4cfa99){_0x1ed525[_0x771f('0x42')]=_0x4cfa99;return _0x1ed525;})[_0x771f('0x22')](respondWithFilteredResult(_0x249f0f,_0x4650a7))[_0x771f('0x43')](handleError(_0x249f0f,null));};exports[_0x771f('0x44')]=function(_0x40bac3,_0x18d9c0){var _0x469b23={'raw':!![],'where':{'id':_0x40bac3[_0x771f('0x45')]['id']}},_0x2d5a66={};_0x2d5a66[_0x771f('0x30')]=_['keys'](db[_0x771f('0x3e')]['rawAttributes']);_0x2d5a66[_0x771f('0x2e')]=_['keys'](_0x40bac3[_0x771f('0x2e')]);_0x2d5a66[_0x771f('0x39')]=_['intersection'](_0x2d5a66['model'],_0x2d5a66[_0x771f('0x2e')]);_0x469b23[_0x771f('0x31')]=_[_0x771f('0x2f')](_0x2d5a66[_0x771f('0x30')],qs[_0x771f('0x32')](_0x40bac3['query'][_0x771f('0x32')]));_0x469b23['attributes']=_0x469b23['attributes']['length']?_0x469b23[_0x771f('0x31')]:_0x2d5a66[_0x771f('0x30')];if(_0x40bac3[_0x771f('0x2e')]['includeAll']){_0x469b23[_0x771f('0x40')]=[{'all':!![]}];}_0x469b23=_[_0x771f('0x3b')]({},_0x469b23,_0x40bac3['options']);return db[_0x771f('0x3e')][_0x771f('0x46')](_0x469b23)[_0x771f('0x22')](handleEntityNotFound(_0x18d9c0,null))[_0x771f('0x22')](respondWithResult(_0x18d9c0,null))[_0x771f('0x43')](handleError(_0x18d9c0,null));};exports['create']=function(_0x47f607,_0xdae94e){return db['Variable'][_0x771f('0x47')](_0x47f607[_0x771f('0x48')],{})[_0x771f('0x22')](function(_0x476847){var _0x12dd4f=_0x47f607[_0x771f('0x49')][_0x771f('0x23')]({'plain':!![]});if(!_0x12dd4f)throw new Error(_0x771f('0x4a'));if(_0x12dd4f[_0x771f('0x4b')]===_0x771f('0x49')){var _0x4bdb75=_0x476847[_0x771f('0x23')]({'plain':!![]});var _0x38cbe2=_0x771f('0x24');return db[_0x771f('0x4c')][_0x771f('0x46')]({'where':{'name':_0x38cbe2,'userProfileId':_0x12dd4f['userProfileId']},'raw':!![]})[_0x771f('0x22')](function(_0x51ffb0){if(_0x51ffb0&&_0x51ffb0[_0x771f('0x4d')]===0x0){return db['UserProfileResource'][_0x771f('0x47')]({'name':_0x4bdb75[_0x771f('0x29')],'resourceId':_0x4bdb75['id'],'type':_0x51ffb0[_0x771f('0x29')],'sectionId':_0x51ffb0['id']},{})[_0x771f('0x22')](function(){return _0x476847;});}else{return _0x476847;}})['catch'](function(_0x3f8c9e){logger[_0x771f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f8c9e);throw _0x3f8c9e;});}return _0x476847;})['then'](respondWithResult(_0xdae94e,0xc9))[_0x771f('0x43')](handleError(_0xdae94e,null));};exports[_0x771f('0x21')]=function(_0x556337,_0x19d52d){if(_0x556337[_0x771f('0x48')]['id']){delete _0x556337[_0x771f('0x48')]['id'];}return db[_0x771f('0x3e')][_0x771f('0x46')]({'where':{'id':_0x556337[_0x771f('0x45')]['id']}})[_0x771f('0x22')](handleEntityNotFound(_0x19d52d,null))['then'](saveUpdates(_0x556337[_0x771f('0x48')],null))[_0x771f('0x22')](respondWithResult(_0x19d52d,null))[_0x771f('0x43')](handleError(_0x19d52d,null));};exports['destroy']=function(_0x3e84b6,_0x1527a9){return db[_0x771f('0x3e')][_0x771f('0x46')]({'where':{'id':_0x3e84b6[_0x771f('0x45')]['id']}})['then'](handleEntityNotFound(_0x1527a9,null))[_0x771f('0x22')](removeEntity(_0x1527a9,null))[_0x771f('0x43')](handleError(_0x1527a9,null));};
\ No newline at end of file