Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index b18ffe2..2774aa6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0962=['rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','update','then','get','ODBC','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','SquareOdbc'];(function(_0x2aa051,_0x20cc53){var _0x15739c=function(_0x45841c){while(--_0x45841c){_0x2aa051['push'](_0x2aa051['shift']());}};_0x15739c(++_0x20cc53);}(_0x0962,0x1e9));var _0x2096=function(_0x113fd3,_0x4644bb){_0x113fd3=_0x113fd3-0x0;var _0x21863e=_0x0962[_0x113fd3];return _0x21863e;};'use strict';var pdf=require(_0x2096('0x0'));var emlformat=require(_0x2096('0x1'));var rimraf=require(_0x2096('0x2'));var zipdir=require(_0x2096('0x3'));var jsonpatch=require(_0x2096('0x4'));var rp=require(_0x2096('0x5'));var moment=require(_0x2096('0x6'));var BPromise=require(_0x2096('0x7'));var Mustache=require(_0x2096('0x8'));var util=require(_0x2096('0x9'));var path=require(_0x2096('0xa'));var sox=require(_0x2096('0xb'));var csv=require(_0x2096('0xc'));var ejs=require(_0x2096('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2096('0xe'));var crypto=require(_0x2096('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2096('0x10'));var Papa=require(_0x2096('0x11'));var Redis=require(_0x2096('0x12'));var authService=require(_0x2096('0x13'));var qs=require(_0x2096('0x14'));var as=require(_0x2096('0x15'));var hardwareService=require(_0x2096('0x16'));var logger=require(_0x2096('0x17'))(_0x2096('0x18'));var utils=require(_0x2096('0x19'));var config=require(_0x2096('0x1a'));var licenseUtil=require(_0x2096('0x1b'));var db=require(_0x2096('0x1c'))['db'];function respondWithStatusCode(_0x460573,_0x4ef77a){_0x4ef77a=_0x4ef77a||0xcc;return function(_0x24fb90){if(_0x24fb90){return _0x460573['sendStatus'](_0x4ef77a);}return _0x460573[_0x2096('0x1d')](_0x4ef77a)[_0x2096('0x1e')]();};}function respondWithResult(_0x5140f4,_0x27cfc1){_0x27cfc1=_0x27cfc1||0xc8;return function(_0x3f54fe){if(_0x3f54fe){return _0x5140f4[_0x2096('0x1d')](_0x27cfc1)[_0x2096('0x1f')](_0x3f54fe);}};}function respondWithFilteredResult(_0x10d7ba,_0x20e1f1){return function(_0x18e05e){if(_0x18e05e){var _0x539805=_0x18e05e[_0x2096('0x20')],_0x5a1574=_0x20e1f1[_0x2096('0x21')],_0x23506a=_0x20e1f1['offset']+_0x20e1f1[_0x2096('0x22')],_0x4467b9;if(_0x23506a>=_0x539805){_0x23506a=_0x539805;_0x4467b9=0xc8;}else{_0x4467b9=0xce;}_0x10d7ba[_0x2096('0x1d')](_0x4467b9);return _0x10d7ba['set'](_0x2096('0x23'),_0x5a1574+'-'+_0x23506a+'/'+_0x539805)[_0x2096('0x1f')](_0x18e05e);}return null;};}function patchUpdates(_0x3efdd6){return function(_0x551e99){try{jsonpatch[_0x2096('0x24')](_0x551e99,_0x3efdd6,!![]);}catch(_0x44f846){return BPromise['reject'](_0x44f846);}return _0x551e99['save']();};}function saveUpdates(_0x3dc9d6,_0x37acba){return function(_0x548225){if(_0x548225){return _0x548225[_0x2096('0x25')](_0x3dc9d6)[_0x2096('0x26')](function(_0x27d6bc){return _0x27d6bc;});}return null;};}function removeEntity(_0x4b5523,_0x52189d){return function(_0x36aa9f){if(_0x36aa9f){return _0x36aa9f['destroy']()[_0x2096('0x26')](function(){var _0x4a66e3=_0x36aa9f[_0x2096('0x27')]({'plain':!![]});var _0x5df903=_0x2096('0x28');return db[_0x2096('0x29')][_0x2096('0x2a')]({'where':{'type':_0x5df903,'resourceId':_0x4a66e3['id']}})['then'](function(){return _0x36aa9f;});})['then'](function(){_0x4b5523[_0x2096('0x1d')](0xcc)[_0x2096('0x1e')]();});}};}function handleEntityNotFound(_0x2525fd,_0x25497b){return function(_0x1aff1f){if(!_0x1aff1f){_0x2525fd[_0x2096('0x2b')](0x194);}return _0x1aff1f;};}function handleError(_0x39e0da,_0x57de26){_0x57de26=_0x57de26||0x1f4;return function(_0x1d7e45){logger[_0x2096('0x2c')](_0x1d7e45[_0x2096('0x2d')]);if(_0x1d7e45[_0x2096('0x2e')]){delete _0x1d7e45[_0x2096('0x2e')];}_0x39e0da[_0x2096('0x1d')](_0x57de26)[_0x2096('0x2f')](_0x1d7e45);};}exports[_0x2096('0x30')]=function(_0x236271,_0x58bbb4){var _0x395be0={},_0x202e34={},_0x54fd34={'count':0x0,'rows':[]};var _0x2e0fb1=_[_0x2096('0x31')](db[_0x2096('0x32')][_0x2096('0x33')],function(_0x12de72){return{'name':_0x12de72[_0x2096('0x34')],'type':_0x12de72[_0x2096('0x35')]['key']};});_0x202e34[_0x2096('0x36')]=_[_0x2096('0x31')](_0x2e0fb1,_0x2096('0x2e'));_0x202e34['query']=_[_0x2096('0x37')](_0x236271[_0x2096('0x38')]);_0x202e34['filters']=_[_0x2096('0x39')](_0x202e34[_0x2096('0x36')],_0x202e34[_0x2096('0x38')]);_0x395be0['attributes']=_['intersection'](_0x202e34[_0x2096('0x36')],qs[_0x2096('0x3a')](_0x236271[_0x2096('0x38')][_0x2096('0x3a')]));_0x395be0[_0x2096('0x3b')]=_0x395be0[_0x2096('0x3b')][_0x2096('0x3c')]?_0x395be0[_0x2096('0x3b')]:_0x202e34[_0x2096('0x36')];if(!_0x236271[_0x2096('0x38')][_0x2096('0x3d')]('nolimit')){_0x395be0[_0x2096('0x22')]=qs[_0x2096('0x22')](_0x236271[_0x2096('0x38')]['limit']);_0x395be0[_0x2096('0x21')]=qs['offset'](_0x236271[_0x2096('0x38')][_0x2096('0x21')]);}_0x395be0[_0x2096('0x3e')]=qs[_0x2096('0x3f')](_0x236271[_0x2096('0x38')][_0x2096('0x3f')]);_0x395be0[_0x2096('0x40')]=qs['filters'](_['pick'](_0x236271[_0x2096('0x38')],_0x202e34[_0x2096('0x41')]),_0x2e0fb1);if(_0x236271['query']['filter']){_0x395be0[_0x2096('0x40')]=_[_0x2096('0x42')](_0x395be0['where'],{'$or':_[_0x2096('0x31')](_0x2e0fb1,function(_0x57b9e7){if(_0x57b9e7[_0x2096('0x35')]!==_0x2096('0x43')){var _0x23cdf4={};_0x23cdf4[_0x57b9e7[_0x2096('0x2e')]]={'$like':'%'+_0x236271[_0x2096('0x38')]['filter']+'%'};return _0x23cdf4;}})});}_0x395be0=_[_0x2096('0x42')]({},_0x395be0,_0x236271['options']);var _0x4e1aaf={'where':_0x395be0[_0x2096('0x40')]};return db[_0x2096('0x32')][_0x2096('0x20')](_0x4e1aaf)[_0x2096('0x26')](function(_0x53d1e0){_0x54fd34[_0x2096('0x20')]=_0x53d1e0;if(_0x236271[_0x2096('0x38')][_0x2096('0x44')]){_0x395be0[_0x2096('0x45')]=[{'all':!![]}];}return db['SquareOdbc'][_0x2096('0x46')](_0x395be0);})[_0x2096('0x26')](function(_0x277d56){_0x54fd34[_0x2096('0x47')]=_0x277d56;return _0x54fd34;})[_0x2096('0x26')](respondWithFilteredResult(_0x58bbb4,_0x395be0))['catch'](handleError(_0x58bbb4,null));};exports[_0x2096('0x48')]=function(_0x46e8e9,_0x5eeba6){var _0x44a7ed={'raw':!![],'where':{'id':_0x46e8e9[_0x2096('0x49')]['id']}},_0x7d23da={};_0x7d23da[_0x2096('0x36')]=_[_0x2096('0x37')](db[_0x2096('0x32')]['rawAttributes']);_0x7d23da['query']=_[_0x2096('0x37')](_0x46e8e9['query']);_0x7d23da['filters']=_[_0x2096('0x39')](_0x7d23da[_0x2096('0x36')],_0x7d23da['query']);_0x44a7ed['attributes']=_['intersection'](_0x7d23da[_0x2096('0x36')],qs['fields'](_0x46e8e9[_0x2096('0x38')][_0x2096('0x3a')]));_0x44a7ed[_0x2096('0x3b')]=_0x44a7ed['attributes']['length']?_0x44a7ed['attributes']:_0x7d23da['model'];if(_0x46e8e9[_0x2096('0x38')][_0x2096('0x44')]){_0x44a7ed['include']=[{'all':!![]}];}_0x44a7ed=_[_0x2096('0x42')]({},_0x44a7ed,_0x46e8e9[_0x2096('0x4a')]);return db[_0x2096('0x32')]['find'](_0x44a7ed)[_0x2096('0x26')](handleEntityNotFound(_0x5eeba6,null))[_0x2096('0x26')](respondWithResult(_0x5eeba6,null))['catch'](handleError(_0x5eeba6,null));};exports[_0x2096('0x4b')]=function(_0x197a92,_0x321094){return db[_0x2096('0x32')][_0x2096('0x4b')](_0x197a92[_0x2096('0x4c')],{})[_0x2096('0x26')](function(_0x3f9cd8){var _0x27f084=_0x197a92['user'][_0x2096('0x27')]({'plain':!![]});if(!_0x27f084)throw new Error(_0x2096('0x4d'));if(_0x27f084[_0x2096('0x4e')]==='user'){var _0x5d879c=_0x3f9cd8[_0x2096('0x27')]({'plain':!![]});var _0x16a1e9=_0x2096('0x28');return db[_0x2096('0x4f')][_0x2096('0x50')]({'where':{'name':_0x16a1e9,'userProfileId':_0x27f084[_0x2096('0x51')]},'raw':!![]})[_0x2096('0x26')](function(_0x172947){if(_0x172947&&_0x172947[_0x2096('0x52')]===0x0){return db['UserProfileResource'][_0x2096('0x4b')]({'name':_0x5d879c[_0x2096('0x2e')],'resourceId':_0x5d879c['id'],'type':_0x172947[_0x2096('0x2e')],'sectionId':_0x172947['id']},{})['then'](function(){return _0x3f9cd8;});}else{return _0x3f9cd8;}})[_0x2096('0x53')](function(_0x5da2fd){logger[_0x2096('0x2c')](_0x2096('0x54'),_0x5da2fd);throw _0x5da2fd;});}return _0x3f9cd8;})[_0x2096('0x26')](respondWithResult(_0x321094,0xc9))[_0x2096('0x53')](handleError(_0x321094,null));};exports[_0x2096('0x25')]=function(_0x2cec3e,_0x131b2c){if(_0x2cec3e[_0x2096('0x4c')]['id']){delete _0x2cec3e[_0x2096('0x4c')]['id'];}return db['SquareOdbc'][_0x2096('0x50')]({'where':{'id':_0x2cec3e[_0x2096('0x49')]['id']}})[_0x2096('0x26')](handleEntityNotFound(_0x131b2c,null))['then'](saveUpdates(_0x2cec3e[_0x2096('0x4c')],null))[_0x2096('0x26')](respondWithResult(_0x131b2c,null))[_0x2096('0x53')](handleError(_0x131b2c,null));};exports[_0x2096('0x2a')]=function(_0x7c94e4,_0x35ac71){return db[_0x2096('0x32')][_0x2096('0x50')]({'where':{'id':_0x7c94e4[_0x2096('0x49')]['id']}})[_0x2096('0x26')](handleEntityNotFound(_0x35ac71,null))['then'](removeEntity(_0x35ac71,null))[_0x2096('0x53')](handleError(_0x35ac71,null));};exports[_0x2096('0x55')]=function(_0x331edc,_0x5d44ad,_0x7e5208){var _0x4799bb;return db['SquareOdbc'][_0x2096('0x50')]({'where':{'id':_0x331edc[_0x2096('0x49')]['id']},'attributes':['id',_0x2096('0x56')]})[_0x2096('0x26')](handleEntityNotFound(_0x5d44ad,null))[_0x2096('0x26')](function(_0xa4160d){if(_0xa4160d){var _0x4bb168=require(_0x2096('0x57'))();_0x4bb168[_0x2096('0x58')](_0xa4160d[_0x2096('0x56')]);_0x4bb168[_0x2096('0x59')]();return _0xa4160d;}})[_0x2096('0x26')](respondWithResult(_0x5d44ad,null))['catch'](handleError(_0x5d44ad,null));};
\ No newline at end of file
+var _0x4d2a=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','update','then','destroy','get','ODBC','UserProfileResource','error','name','map','SquareOdbc','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','include','create','body','user','role','UserProfileSection','find','autoAssociation','catch','params','test','odbc','openSync','dsn','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x320f44,_0x2619b8){var _0x460136=function(_0x49b981){while(--_0x49b981){_0x320f44['push'](_0x320f44['shift']());}};_0x460136(++_0x2619b8);}(_0x4d2a,0x1cf));var _0xa4d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d2a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa4d2('0x0'));var rimraf=require(_0xa4d2('0x1'));var zipdir=require(_0xa4d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa4d2('0x3'));var moment=require('moment');var BPromise=require(_0xa4d2('0x4'));var Mustache=require('mustache');var util=require(_0xa4d2('0x5'));var path=require(_0xa4d2('0x6'));var sox=require(_0xa4d2('0x7'));var csv=require('to-csv');var ejs=require(_0xa4d2('0x8'));var fs=require('fs');var fs_extra=require(_0xa4d2('0x9'));var _=require(_0xa4d2('0xa'));var squel=require(_0xa4d2('0xb'));var crypto=require(_0xa4d2('0xc'));var jsforce=require(_0xa4d2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa4d2('0xe'));var querystring=require(_0xa4d2('0xf'));var Papa=require(_0xa4d2('0x10'));var Redis=require('ioredis');var authService=require(_0xa4d2('0x11'));var qs=require(_0xa4d2('0x12'));var as=require(_0xa4d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4d2('0x14'))(_0xa4d2('0x15'));var utils=require('../../config/utils');var config=require(_0xa4d2('0x16'));var licenseUtil=require(_0xa4d2('0x17'));var db=require(_0xa4d2('0x18'))['db'];function respondWithStatusCode(_0x5cde54,_0x36e34a){_0x36e34a=_0x36e34a||0xcc;return function(_0x16e782){if(_0x16e782){return _0x5cde54[_0xa4d2('0x19')](_0x36e34a);}return _0x5cde54[_0xa4d2('0x1a')](_0x36e34a)[_0xa4d2('0x1b')]();};}function respondWithResult(_0x55e1da,_0x4d9a1b){_0x4d9a1b=_0x4d9a1b||0xc8;return function(_0x2f2ba9){if(_0x2f2ba9){return _0x55e1da[_0xa4d2('0x1a')](_0x4d9a1b)['json'](_0x2f2ba9);}};}function respondWithFilteredResult(_0x511578,_0x2e1e78){return function(_0x2451d9){if(_0x2451d9){var _0x7ca645=typeof _0x2e1e78[_0xa4d2('0x1c')]===_0xa4d2('0x1d')&&typeof _0x2e1e78[_0xa4d2('0x1e')]===_0xa4d2('0x1d');var _0x4b853b=_0x2451d9['count'];var _0x1102df=_0x7ca645?0x0:_0x2e1e78[_0xa4d2('0x1c')];var _0x5d66e2=_0x7ca645?_0x2451d9[_0xa4d2('0x1f')]:_0x2e1e78['offset']+_0x2e1e78[_0xa4d2('0x1e')];var _0x165357;if(_0x5d66e2>=_0x4b853b){_0x5d66e2=_0x4b853b;_0x165357=0xc8;}else{_0x165357=0xce;}_0x511578[_0xa4d2('0x1a')](_0x165357);return _0x511578['set']('Content-Range',_0x1102df+'-'+_0x5d66e2+'/'+_0x4b853b)[_0xa4d2('0x20')](_0x2451d9);}return null;};}function patchUpdates(_0x32e397){return function(_0x8fbc62){try{jsonpatch[_0xa4d2('0x21')](_0x8fbc62,_0x32e397,!![]);}catch(_0x488500){return BPromise['reject'](_0x488500);}return _0x8fbc62['save']();};}function saveUpdates(_0x2f64e3,_0x44c653){return function(_0x321b33){if(_0x321b33){return _0x321b33[_0xa4d2('0x22')](_0x2f64e3)[_0xa4d2('0x23')](function(_0x48f506){return _0x48f506;});}return null;};}function removeEntity(_0x183d11,_0x1fe757){return function(_0x3f4f91){if(_0x3f4f91){return _0x3f4f91[_0xa4d2('0x24')]()[_0xa4d2('0x23')](function(){var _0x48b474=_0x3f4f91[_0xa4d2('0x25')]({'plain':!![]});var _0x6da3c4=_0xa4d2('0x26');return db[_0xa4d2('0x27')][_0xa4d2('0x24')]({'where':{'type':_0x6da3c4,'resourceId':_0x48b474['id']}})[_0xa4d2('0x23')](function(){return _0x3f4f91;});})[_0xa4d2('0x23')](function(){_0x183d11[_0xa4d2('0x1a')](0xcc)[_0xa4d2('0x1b')]();});}};}function handleEntityNotFound(_0x1a9118,_0x7bc4e6){return function(_0x58c532){if(!_0x58c532){_0x1a9118[_0xa4d2('0x19')](0x194);}return _0x58c532;};}function handleError(_0x328a7f,_0x38f4b0){_0x38f4b0=_0x38f4b0||0x1f4;return function(_0x2fd3b4){logger[_0xa4d2('0x28')](_0x2fd3b4['stack']);if(_0x2fd3b4[_0xa4d2('0x29')]){delete _0x2fd3b4[_0xa4d2('0x29')];}_0x328a7f[_0xa4d2('0x1a')](_0x38f4b0)['send'](_0x2fd3b4);};}exports['index']=function(_0x4b372d,_0x4fcec0){var _0x100dc7={},_0x4acf66={},_0x405b3b={'count':0x0,'rows':[]};var _0x31a4da=_[_0xa4d2('0x2a')](db[_0xa4d2('0x2b')][_0xa4d2('0x2c')],function(_0x179864){return{'name':_0x179864[_0xa4d2('0x2d')],'type':_0x179864[_0xa4d2('0x2e')]['key']};});_0x4acf66['model']=_[_0xa4d2('0x2a')](_0x31a4da,_0xa4d2('0x29'));_0x4acf66[_0xa4d2('0x2f')]=_[_0xa4d2('0x30')](_0x4b372d[_0xa4d2('0x2f')]);_0x4acf66[_0xa4d2('0x31')]=_[_0xa4d2('0x32')](_0x4acf66['model'],_0x4acf66['query']);_0x100dc7[_0xa4d2('0x33')]=_[_0xa4d2('0x32')](_0x4acf66[_0xa4d2('0x34')],qs[_0xa4d2('0x35')](_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x35')]));_0x100dc7[_0xa4d2('0x33')]=_0x100dc7['attributes'][_0xa4d2('0x36')]?_0x100dc7[_0xa4d2('0x33')]:_0x4acf66[_0xa4d2('0x34')];if(!_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x37')](_0xa4d2('0x38'))){_0x100dc7[_0xa4d2('0x1e')]=qs['limit'](_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x1e')]);_0x100dc7[_0xa4d2('0x1c')]=qs[_0xa4d2('0x1c')](_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x1c')]);}_0x100dc7['order']=qs['sort'](_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x39')]);_0x100dc7[_0xa4d2('0x3a')]=qs[_0xa4d2('0x31')](_[_0xa4d2('0x3b')](_0x4b372d[_0xa4d2('0x2f')],_0x4acf66[_0xa4d2('0x31')]),_0x31a4da);if(_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x3c')]){_0x100dc7[_0xa4d2('0x3a')]=_[_0xa4d2('0x3d')](_0x100dc7[_0xa4d2('0x3a')],{'$or':_[_0xa4d2('0x2a')](_0x31a4da,function(_0x13f960){if(_0x13f960['type']!==_0xa4d2('0x3e')){var _0x401ee8={};_0x401ee8[_0x13f960['name']]={'$like':'%'+_0x4b372d['query'][_0xa4d2('0x3c')]+'%'};return _0x401ee8;}})});}_0x100dc7=_[_0xa4d2('0x3d')]({},_0x100dc7,_0x4b372d[_0xa4d2('0x3f')]);var _0x48bdfa={'where':_0x100dc7[_0xa4d2('0x3a')]};return db[_0xa4d2('0x2b')][_0xa4d2('0x1f')](_0x48bdfa)['then'](function(_0x2f1cd0){_0x405b3b[_0xa4d2('0x1f')]=_0x2f1cd0;if(_0x4b372d[_0xa4d2('0x2f')][_0xa4d2('0x40')]){_0x100dc7['include']=[{'all':!![]}];}return db[_0xa4d2('0x2b')][_0xa4d2('0x41')](_0x100dc7);})[_0xa4d2('0x23')](function(_0x46e8c2){_0x405b3b[_0xa4d2('0x42')]=_0x46e8c2;return _0x405b3b;})[_0xa4d2('0x23')](respondWithFilteredResult(_0x4fcec0,_0x100dc7))['catch'](handleError(_0x4fcec0,null));};exports['show']=function(_0x75b7e7,_0x476945){var _0x1f2938={'raw':!![],'where':{'id':_0x75b7e7['params']['id']}},_0x5fb36={};_0x5fb36[_0xa4d2('0x34')]=_['keys'](db[_0xa4d2('0x2b')][_0xa4d2('0x2c')]);_0x5fb36[_0xa4d2('0x2f')]=_[_0xa4d2('0x30')](_0x75b7e7[_0xa4d2('0x2f')]);_0x5fb36['filters']=_[_0xa4d2('0x32')](_0x5fb36[_0xa4d2('0x34')],_0x5fb36[_0xa4d2('0x2f')]);_0x1f2938[_0xa4d2('0x33')]=_['intersection'](_0x5fb36[_0xa4d2('0x34')],qs['fields'](_0x75b7e7[_0xa4d2('0x2f')][_0xa4d2('0x35')]));_0x1f2938['attributes']=_0x1f2938[_0xa4d2('0x33')][_0xa4d2('0x36')]?_0x1f2938['attributes']:_0x5fb36[_0xa4d2('0x34')];if(_0x75b7e7['query']['includeAll']){_0x1f2938[_0xa4d2('0x43')]=[{'all':!![]}];}_0x1f2938=_[_0xa4d2('0x3d')]({},_0x1f2938,_0x75b7e7['options']);return db[_0xa4d2('0x2b')]['find'](_0x1f2938)[_0xa4d2('0x23')](handleEntityNotFound(_0x476945,null))[_0xa4d2('0x23')](respondWithResult(_0x476945,null))['catch'](handleError(_0x476945,null));};exports[_0xa4d2('0x44')]=function(_0xca14ff,_0x14d8c1){return db['SquareOdbc']['create'](_0xca14ff[_0xa4d2('0x45')],{})[_0xa4d2('0x23')](function(_0x25dd5f){var _0x51f4ea=_0xca14ff[_0xa4d2('0x46')][_0xa4d2('0x25')]({'plain':!![]});if(!_0x51f4ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51f4ea[_0xa4d2('0x47')]===_0xa4d2('0x46')){var _0xdb1fe0=_0x25dd5f[_0xa4d2('0x25')]({'plain':!![]});var _0x15eee5=_0xa4d2('0x26');return db[_0xa4d2('0x48')][_0xa4d2('0x49')]({'where':{'name':_0x15eee5,'userProfileId':_0x51f4ea['userProfileId']},'raw':!![]})['then'](function(_0x1273ab){if(_0x1273ab&&_0x1273ab[_0xa4d2('0x4a')]===0x0){return db[_0xa4d2('0x27')]['create']({'name':_0xdb1fe0[_0xa4d2('0x29')],'resourceId':_0xdb1fe0['id'],'type':_0x1273ab[_0xa4d2('0x29')],'sectionId':_0x1273ab['id']},{})[_0xa4d2('0x23')](function(){return _0x25dd5f;});}else{return _0x25dd5f;}})[_0xa4d2('0x4b')](function(_0x26f2ab){logger[_0xa4d2('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26f2ab);throw _0x26f2ab;});}return _0x25dd5f;})['then'](respondWithResult(_0x14d8c1,0xc9))['catch'](handleError(_0x14d8c1,null));};exports[_0xa4d2('0x22')]=function(_0x30aca0,_0x31d108){if(_0x30aca0[_0xa4d2('0x45')]['id']){delete _0x30aca0[_0xa4d2('0x45')]['id'];}return db[_0xa4d2('0x2b')][_0xa4d2('0x49')]({'where':{'id':_0x30aca0[_0xa4d2('0x4c')]['id']}})[_0xa4d2('0x23')](handleEntityNotFound(_0x31d108,null))[_0xa4d2('0x23')](saveUpdates(_0x30aca0[_0xa4d2('0x45')],null))[_0xa4d2('0x23')](respondWithResult(_0x31d108,null))['catch'](handleError(_0x31d108,null));};exports[_0xa4d2('0x24')]=function(_0x2808b7,_0xf3ed84){return db[_0xa4d2('0x2b')][_0xa4d2('0x49')]({'where':{'id':_0x2808b7[_0xa4d2('0x4c')]['id']}})[_0xa4d2('0x23')](handleEntityNotFound(_0xf3ed84,null))[_0xa4d2('0x23')](removeEntity(_0xf3ed84,null))['catch'](handleError(_0xf3ed84,null));};exports[_0xa4d2('0x4d')]=function(_0x54b7e7,_0x2588bf,_0x4afa53){var _0x2c33c2;return db[_0xa4d2('0x2b')]['find']({'where':{'id':_0x54b7e7[_0xa4d2('0x4c')]['id']},'attributes':['id','dsn']})[_0xa4d2('0x23')](handleEntityNotFound(_0x2588bf,null))[_0xa4d2('0x23')](function(_0x30849b){if(_0x30849b){var _0x10afa8=require(_0xa4d2('0x4e'))();_0x10afa8[_0xa4d2('0x4f')](_0x30849b[_0xa4d2('0x50')]);_0x10afa8['closeSync']();return _0x30849b;}})[_0xa4d2('0x23')](respondWithResult(_0x2588bf,null))[_0xa4d2('0x4b')](handleError(_0x2588bf,null));};
\ No newline at end of file