Built motion from commit 4c579f6b.|2.5.32
[motion2.git] / server / api / intDynamics365Configuration / intDynamics365Configuration.controller.js
index cbcc60c..6fc3733 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc98f=['findOne','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','stack','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','find','create','body','destroy','getFields','getSubjects'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xc98f,0x11d));var _0xfc98=function(_0x432b60,_0x1559ed){_0x432b60=_0x432b60-0x0;var _0x5a5109=_0xc98f[_0x432b60];return _0x5a5109;};'use strict';var emlformat=require(_0xfc98('0x0'));var rimraf=require(_0xfc98('0x1'));var zipdir=require(_0xfc98('0x2'));var jsonpatch=require(_0xfc98('0x3'));var rp=require(_0xfc98('0x4'));var moment=require('moment');var BPromise=require(_0xfc98('0x5'));var Mustache=require('mustache');var util=require(_0xfc98('0x6'));var path=require(_0xfc98('0x7'));var sox=require(_0xfc98('0x8'));var csv=require(_0xfc98('0x9'));var ejs=require(_0xfc98('0xa'));var fs=require('fs');var fs_extra=require(_0xfc98('0xb'));var _=require(_0xfc98('0xc'));var squel=require(_0xfc98('0xd'));var crypto=require(_0xfc98('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfc98('0xf'));var toCsv=require(_0xfc98('0x9'));var querystring=require(_0xfc98('0x10'));var Papa=require(_0xfc98('0x11'));var Redis=require(_0xfc98('0x12'));var authService=require(_0xfc98('0x13'));var qs=require(_0xfc98('0x14'));var as=require(_0xfc98('0x15'));var hardwareService=require(_0xfc98('0x16'));var logger=require(_0xfc98('0x17'))(_0xfc98('0x18'));var utils=require('../../config/utils');var config=require(_0xfc98('0x19'));var licenseUtil=require(_0xfc98('0x1a'));var db=require(_0xfc98('0x1b'))['db'];var jayson=require(_0xfc98('0x1c'));var client=jayson[_0xfc98('0x1d')][_0xfc98('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x43046c,_0x9b3fe4,_0x4c5864,_0xddc56f){return new BPromise(function(_0x3d1cf7,_0x538539){var _0x2b00a4=_0xddc56f||client;return _0x2b00a4[_0xfc98('0x1f')](_0x43046c,_0x4c5864)[_0xfc98('0x20')](function(_0x2f6ca4){logger[_0xfc98('0x21')](_0xfc98('0x22'),_0x9b3fe4,_0xfc98('0x23'));logger[_0xfc98('0x24')](_0xfc98('0x25'),_0x9b3fe4,_0xfc98('0x23'),JSON['stringify'](_0x2f6ca4));if(_0x2f6ca4[_0xfc98('0x26')]){if(_0x2f6ca4[_0xfc98('0x26')][_0xfc98('0x27')]===0x1f4){logger[_0xfc98('0x26')](_0xfc98('0x22'),_0x9b3fe4,_0x2f6ca4[_0xfc98('0x26')][_0xfc98('0x28')]);return _0x538539(_0x2f6ca4['error'][_0xfc98('0x28')]);}logger[_0xfc98('0x26')](_0xfc98('0x22'),_0x9b3fe4,_0x2f6ca4[_0xfc98('0x26')]['message']);return _0x3d1cf7(_0x2f6ca4[_0xfc98('0x26')][_0xfc98('0x28')]);}else{logger[_0xfc98('0x21')](_0xfc98('0x22'),_0x9b3fe4,'request\x20sent');_0x3d1cf7(_0x2f6ca4[_0xfc98('0x29')][_0xfc98('0x28')]);}})[_0xfc98('0x2a')](function(_0x3104d5){logger[_0xfc98('0x26')](_0xfc98('0x22'),_0x9b3fe4,_0x3104d5);_0x538539(_0x3104d5);});});}function respondWithStatusCode(_0xf68889,_0x15897a){_0x15897a=_0x15897a||0xcc;return function(_0x425482){if(_0x425482){return _0xf68889[_0xfc98('0x2b')](_0x15897a);}return _0xf68889['status'](_0x15897a)[_0xfc98('0x2c')]();};}function respondWithResult(_0x2cf474,_0x201aec){_0x201aec=_0x201aec||0xc8;return function(_0x53edc7){if(_0x53edc7){return _0x2cf474[_0xfc98('0x2d')](_0x201aec)[_0xfc98('0x2e')](_0x53edc7);}};}function respondWithFilteredResult(_0x1285c3,_0x51552){return function(_0x800cdc){if(_0x800cdc){var _0x580b39=typeof _0x51552[_0xfc98('0x2f')]==='undefined'&&typeof _0x51552[_0xfc98('0x30')]===_0xfc98('0x31');var _0x1ee267=_0x800cdc['count'];var _0x388de5=_0x580b39?0x0:_0x51552[_0xfc98('0x2f')];var _0x4871e2=_0x580b39?_0x800cdc[_0xfc98('0x32')]:_0x51552[_0xfc98('0x2f')]+_0x51552[_0xfc98('0x30')];var _0x3b5b57;if(_0x4871e2>=_0x1ee267){_0x4871e2=_0x1ee267;_0x3b5b57=0xc8;}else{_0x3b5b57=0xce;}_0x1285c3['status'](_0x3b5b57);return _0x1285c3[_0xfc98('0x33')](_0xfc98('0x34'),_0x388de5+'-'+_0x4871e2+'/'+_0x1ee267)[_0xfc98('0x2e')](_0x800cdc);}return null;};}function patchUpdates(_0x43caa6){return function(_0x170961){try{jsonpatch[_0xfc98('0x35')](_0x170961,_0x43caa6,!![]);}catch(_0x94f6d2){return BPromise['reject'](_0x94f6d2);}return _0x170961['save']();};}function saveUpdates(_0x1aaba3,_0x4f9bac){return function(_0x2de725){if(_0x2de725){return _0x2de725[_0xfc98('0x36')](_0x1aaba3)[_0xfc98('0x20')](function(_0x59dd6e){return _0x59dd6e;});}return null;};}function removeEntity(_0xb6204e,_0x1d713e){return function(_0x5e1a25){if(_0x5e1a25){return _0x5e1a25['destroy']()['then'](function(){_0xb6204e[_0xfc98('0x2d')](0xcc)[_0xfc98('0x2c')]();});}};}function handleEntityNotFound(_0x553a50,_0xd549c3){return function(_0xada34c){if(!_0xada34c){_0x553a50[_0xfc98('0x2b')](0x194);}return _0xada34c;};}function handleError(_0x19e678,_0x2d1ac3){_0x2d1ac3=_0x2d1ac3||0x1f4;return function(_0x1e2288){logger[_0xfc98('0x26')](_0x1e2288[_0xfc98('0x37')]);if(_0x1e2288[_0xfc98('0x38')]){delete _0x1e2288[_0xfc98('0x38')];}_0x19e678[_0xfc98('0x2d')](_0x2d1ac3)[_0xfc98('0x39')](_0x1e2288);};}exports['index']=function(_0x23d9ea,_0x4e9395){var _0x5c280e={},_0x92d542={},_0xeb391b={'count':0x0,'rows':[]};var _0x732de7=_[_0xfc98('0x3a')](db[_0xfc98('0x3b')][_0xfc98('0x3c')],function(_0x2b575a){return{'name':_0x2b575a[_0xfc98('0x3d')],'type':_0x2b575a[_0xfc98('0x3e')][_0xfc98('0x3f')]};});_0x92d542[_0xfc98('0x40')]=_['map'](_0x732de7,_0xfc98('0x38'));_0x92d542['query']=_[_0xfc98('0x41')](_0x23d9ea[_0xfc98('0x42')]);_0x92d542[_0xfc98('0x43')]=_[_0xfc98('0x44')](_0x92d542[_0xfc98('0x40')],_0x92d542[_0xfc98('0x42')]);_0x5c280e['attributes']=_[_0xfc98('0x44')](_0x92d542[_0xfc98('0x40')],qs[_0xfc98('0x45')](_0x23d9ea[_0xfc98('0x42')][_0xfc98('0x45')]));_0x5c280e['attributes']=_0x5c280e[_0xfc98('0x46')][_0xfc98('0x47')]?_0x5c280e['attributes']:_0x92d542[_0xfc98('0x40')];if(!_0x23d9ea['query'][_0xfc98('0x48')](_0xfc98('0x49'))){_0x5c280e[_0xfc98('0x30')]=qs[_0xfc98('0x30')](_0x23d9ea[_0xfc98('0x42')][_0xfc98('0x30')]);_0x5c280e['offset']=qs['offset'](_0x23d9ea[_0xfc98('0x42')][_0xfc98('0x2f')]);}_0x5c280e['order']=qs[_0xfc98('0x4a')](_0x23d9ea[_0xfc98('0x42')]['sort']);_0x5c280e['where']=qs[_0xfc98('0x43')](_[_0xfc98('0x4b')](_0x23d9ea[_0xfc98('0x42')],_0x92d542[_0xfc98('0x43')]),_0x732de7);if(_0x23d9ea[_0xfc98('0x42')]['filter']){_0x5c280e[_0xfc98('0x4c')]=_[_0xfc98('0x4d')](_0x5c280e[_0xfc98('0x4c')],{'$or':_[_0xfc98('0x3a')](_0x732de7,function(_0x250314){if(_0x250314['type']!==_0xfc98('0x4e')){var _0x1390e4={};_0x1390e4[_0x250314[_0xfc98('0x38')]]={'$like':'%'+_0x23d9ea[_0xfc98('0x42')][_0xfc98('0x4f')]+'%'};return _0x1390e4;}})});}_0x5c280e=_[_0xfc98('0x4d')]({},_0x5c280e,_0x23d9ea[_0xfc98('0x50')]);var _0xac4ba8={'where':_0x5c280e[_0xfc98('0x4c')]};return db[_0xfc98('0x3b')][_0xfc98('0x32')](_0xac4ba8)[_0xfc98('0x20')](function(_0x41a9e4){_0xeb391b[_0xfc98('0x32')]=_0x41a9e4;if(_0x23d9ea[_0xfc98('0x42')][_0xfc98('0x51')]){_0x5c280e['include']=[{'all':!![]}];}return db[_0xfc98('0x3b')][_0xfc98('0x52')](_0x5c280e);})[_0xfc98('0x20')](function(_0xa9575a){_0xeb391b['rows']=_0xa9575a;return _0xeb391b;})[_0xfc98('0x20')](respondWithFilteredResult(_0x4e9395,_0x5c280e))[_0xfc98('0x2a')](handleError(_0x4e9395,null));};exports[_0xfc98('0x53')]=function(_0x5a8264,_0x5a7ac5){var _0x424e27={'raw':![],'where':{'id':_0x5a8264[_0xfc98('0x54')]['id']}},_0x271043={};_0x271043[_0xfc98('0x40')]=_[_0xfc98('0x41')](db[_0xfc98('0x3b')][_0xfc98('0x3c')]);_0x271043['query']=_[_0xfc98('0x41')](_0x5a8264[_0xfc98('0x42')]);_0x271043['filters']=_['intersection'](_0x271043[_0xfc98('0x40')],_0x271043[_0xfc98('0x42')]);_0x424e27[_0xfc98('0x46')]=_[_0xfc98('0x44')](_0x271043['model'],qs['fields'](_0x5a8264[_0xfc98('0x42')][_0xfc98('0x45')]));_0x424e27[_0xfc98('0x46')]=_0x424e27[_0xfc98('0x46')]['length']?_0x424e27['attributes']:_0x271043[_0xfc98('0x40')];if(_0x5a8264[_0xfc98('0x42')][_0xfc98('0x51')]){_0x424e27['include']=[{'all':!![]}];}_0x424e27=_[_0xfc98('0x4d')]({},_0x424e27,_0x5a8264['options']);return db[_0xfc98('0x3b')][_0xfc98('0x55')](_0x424e27)[_0xfc98('0x20')](handleEntityNotFound(_0x5a7ac5,null))['then'](respondWithResult(_0x5a7ac5,null))[_0xfc98('0x2a')](handleError(_0x5a7ac5,null));};exports[_0xfc98('0x56')]=function(_0x387d3e,_0xfa744){return db[_0xfc98('0x3b')][_0xfc98('0x56')](_0x387d3e[_0xfc98('0x57')],{})[_0xfc98('0x20')](respondWithResult(_0xfa744,0xc9))[_0xfc98('0x2a')](handleError(_0xfa744,null));};exports[_0xfc98('0x36')]=function(_0x1cbb79,_0x3627ed){if(_0x1cbb79[_0xfc98('0x57')]['id']){delete _0x1cbb79[_0xfc98('0x57')]['id'];}return db[_0xfc98('0x3b')][_0xfc98('0x55')]({'where':{'id':_0x1cbb79[_0xfc98('0x54')]['id']}})[_0xfc98('0x20')](handleEntityNotFound(_0x3627ed,null))['then'](saveUpdates(_0x1cbb79['body'],null))[_0xfc98('0x20')](respondWithResult(_0x3627ed,null))['catch'](handleError(_0x3627ed,null));};exports[_0xfc98('0x58')]=function(_0x337d78,_0x1ba329){return db['Dynamics365Configuration']['find']({'where':{'id':_0x337d78['params']['id']}})[_0xfc98('0x20')](handleEntityNotFound(_0x1ba329,null))[_0xfc98('0x20')](removeEntity(_0x1ba329,null))[_0xfc98('0x2a')](handleError(_0x1ba329,null));};exports[_0xfc98('0x59')]=function(_0x1e378d,_0x16375b,_0x32ba1e){var _0x5cbe9b={};var _0x42621e={};var _0x35cf21;var _0x1dbd1f;return db[_0xfc98('0x3b')]['findOne']({'where':{'id':_0x1e378d['params']['id']}})[_0xfc98('0x20')](handleEntityNotFound(_0x16375b,null))[_0xfc98('0x20')](function(_0x3b5d2a){if(_0x3b5d2a){_0x35cf21=_0x3b5d2a;_0x42621e[_0xfc98('0x40')]=_[_0xfc98('0x41')](db['Dynamics365Field'][_0xfc98('0x3c')]);_0x42621e[_0xfc98('0x42')]=_[_0xfc98('0x41')](_0x1e378d['query']);_0x42621e[_0xfc98('0x43')]=_[_0xfc98('0x44')](_0x42621e[_0xfc98('0x40')],_0x42621e[_0xfc98('0x42')]);_0x5cbe9b['attributes']=_[_0xfc98('0x44')](_0x42621e[_0xfc98('0x40')],qs['fields'](_0x1e378d[_0xfc98('0x42')][_0xfc98('0x45')]));_0x5cbe9b[_0xfc98('0x46')]=_0x5cbe9b[_0xfc98('0x46')][_0xfc98('0x47')]?_0x5cbe9b['attributes']:_0x42621e[_0xfc98('0x40')];_0x5cbe9b['order']=qs['sort'](_0x1e378d[_0xfc98('0x42')]['sort']);_0x5cbe9b[_0xfc98('0x4c')]=qs[_0xfc98('0x43')](_['pick'](_0x1e378d[_0xfc98('0x42')],_0x42621e[_0xfc98('0x43')]));if(_0x1e378d[_0xfc98('0x42')][_0xfc98('0x4f')]){_0x5cbe9b[_0xfc98('0x4c')]=_['merge'](_0x5cbe9b[_0xfc98('0x4c')],{'$or':_[_0xfc98('0x3a')](_0x5cbe9b[_0xfc98('0x46')],function(_0x521fe0){var _0x2ba738={};_0x2ba738[_0x521fe0]={'$like':'%'+_0x1e378d[_0xfc98('0x42')][_0xfc98('0x4f')]+'%'};return _0x2ba738;})});}_0x5cbe9b=_[_0xfc98('0x4d')]({},_0x5cbe9b,_0x1e378d[_0xfc98('0x50')]);return _0x35cf21[_0xfc98('0x59')](_0x5cbe9b);}})['then'](function(_0x17c9ae){if(_0x17c9ae){_0x1dbd1f=_0x17c9ae[_0xfc98('0x47')];if(!_0x1e378d[_0xfc98('0x42')][_0xfc98('0x48')](_0xfc98('0x49'))){_0x5cbe9b[_0xfc98('0x30')]=qs[_0xfc98('0x30')](_0x1e378d['query'][_0xfc98('0x30')]);_0x5cbe9b[_0xfc98('0x2f')]=qs[_0xfc98('0x2f')](_0x1e378d[_0xfc98('0x42')][_0xfc98('0x2f')]);}return _0x35cf21[_0xfc98('0x59')](_0x5cbe9b);}})[_0xfc98('0x20')](function(_0x32540a){if(_0x32540a){return _0x32540a?{'count':_0x1dbd1f,'rows':_0x32540a}:null;}})[_0xfc98('0x20')](respondWithResult(_0x16375b,null))[_0xfc98('0x2a')](handleError(_0x16375b,null));};exports[_0xfc98('0x5a')]=function(_0x5c8429,_0x3a749e,_0x1db635){var _0x22d27c={};var _0x320652={};var _0x4e4601;var _0x1ca6e4;return db['Dynamics365Configuration'][_0xfc98('0x5b')]({'where':{'id':_0x5c8429[_0xfc98('0x54')]['id']}})[_0xfc98('0x20')](handleEntityNotFound(_0x3a749e,null))[_0xfc98('0x20')](function(_0x75c9be){if(_0x75c9be){_0x4e4601=_0x75c9be;_0x320652[_0xfc98('0x40')]=_[_0xfc98('0x41')](db[_0xfc98('0x5c')][_0xfc98('0x3c')]);_0x320652[_0xfc98('0x42')]=_[_0xfc98('0x41')](_0x5c8429['query']);_0x320652[_0xfc98('0x43')]=_[_0xfc98('0x44')](_0x320652[_0xfc98('0x40')],_0x320652['query']);_0x22d27c[_0xfc98('0x46')]=_[_0xfc98('0x44')](_0x320652[_0xfc98('0x40')],qs[_0xfc98('0x45')](_0x5c8429['query'][_0xfc98('0x45')]));_0x22d27c[_0xfc98('0x46')]=_0x22d27c[_0xfc98('0x46')][_0xfc98('0x47')]?_0x22d27c[_0xfc98('0x46')]:_0x320652['model'];_0x22d27c['order']=qs[_0xfc98('0x4a')](_0x5c8429[_0xfc98('0x42')][_0xfc98('0x4a')]);_0x22d27c[_0xfc98('0x4c')]=qs[_0xfc98('0x43')](_[_0xfc98('0x4b')](_0x5c8429['query'],_0x320652[_0xfc98('0x43')]));if(_0x5c8429[_0xfc98('0x42')][_0xfc98('0x4f')]){_0x22d27c[_0xfc98('0x4c')]=_[_0xfc98('0x4d')](_0x22d27c[_0xfc98('0x4c')],{'$or':_[_0xfc98('0x3a')](_0x22d27c[_0xfc98('0x46')],function(_0x1e1b84){var _0xee5f18={};_0xee5f18[_0x1e1b84]={'$like':'%'+_0x5c8429[_0xfc98('0x42')][_0xfc98('0x4f')]+'%'};return _0xee5f18;})});}_0x22d27c=_['merge']({},_0x22d27c,_0x5c8429[_0xfc98('0x50')]);return _0x4e4601[_0xfc98('0x5a')](_0x22d27c);}})[_0xfc98('0x20')](function(_0x2f6950){if(_0x2f6950){_0x1ca6e4=_0x2f6950['length'];if(!_0x5c8429[_0xfc98('0x42')][_0xfc98('0x48')](_0xfc98('0x49'))){_0x22d27c[_0xfc98('0x30')]=qs['limit'](_0x5c8429[_0xfc98('0x42')]['limit']);_0x22d27c[_0xfc98('0x2f')]=qs['offset'](_0x5c8429['query'][_0xfc98('0x2f')]);}return _0x4e4601[_0xfc98('0x5a')](_0x22d27c);}})[_0xfc98('0x20')](function(_0x5b8684){if(_0x5b8684){return _0x5b8684?{'count':_0x1ca6e4,'rows':_0x5b8684}:null;}})[_0xfc98('0x20')](respondWithResult(_0x3a749e,null))[_0xfc98('0x2a')](handleError(_0x3a749e,null));};exports[_0xfc98('0x5d')]=function(_0x5b921c,_0x4d846f,_0x2a973b){var _0x46bc65={};var _0x2b2b9b={};var _0x3b96f6;var _0x5b9f6e;return db[_0xfc98('0x3b')]['findOne']({'where':{'id':_0x5b921c['params']['id']}})['then'](handleEntityNotFound(_0x4d846f,null))[_0xfc98('0x20')](function(_0xada5d3){if(_0xada5d3){_0x3b96f6=_0xada5d3;_0x2b2b9b['model']=_[_0xfc98('0x41')](db[_0xfc98('0x5c')][_0xfc98('0x3c')]);_0x2b2b9b['query']=_[_0xfc98('0x41')](_0x5b921c[_0xfc98('0x42')]);_0x2b2b9b[_0xfc98('0x43')]=_[_0xfc98('0x44')](_0x2b2b9b[_0xfc98('0x40')],_0x2b2b9b['query']);_0x46bc65['attributes']=_[_0xfc98('0x44')](_0x2b2b9b[_0xfc98('0x40')],qs[_0xfc98('0x45')](_0x5b921c[_0xfc98('0x42')]['fields']));_0x46bc65[_0xfc98('0x46')]=_0x46bc65[_0xfc98('0x46')]['length']?_0x46bc65[_0xfc98('0x46')]:_0x2b2b9b[_0xfc98('0x40')];_0x46bc65['order']=qs[_0xfc98('0x4a')](_0x5b921c['query'][_0xfc98('0x4a')]);_0x46bc65[_0xfc98('0x4c')]=qs[_0xfc98('0x43')](_[_0xfc98('0x4b')](_0x5b921c[_0xfc98('0x42')],_0x2b2b9b['filters']));if(_0x5b921c[_0xfc98('0x42')][_0xfc98('0x4f')]){_0x46bc65[_0xfc98('0x4c')]=_[_0xfc98('0x4d')](_0x46bc65[_0xfc98('0x4c')],{'$or':_[_0xfc98('0x3a')](_0x46bc65[_0xfc98('0x46')],function(_0x592d65){var _0xc54d76={};_0xc54d76[_0x592d65]={'$like':'%'+_0x5b921c[_0xfc98('0x42')][_0xfc98('0x4f')]+'%'};return _0xc54d76;})});}_0x46bc65=_[_0xfc98('0x4d')]({},_0x46bc65,_0x5b921c[_0xfc98('0x50')]);return _0x3b96f6['getDescriptions'](_0x46bc65);}})[_0xfc98('0x20')](function(_0x265abe){if(_0x265abe){_0x5b9f6e=_0x265abe[_0xfc98('0x47')];if(!_0x5b921c[_0xfc98('0x42')]['hasOwnProperty'](_0xfc98('0x49'))){_0x46bc65['limit']=qs[_0xfc98('0x30')](_0x5b921c['query']['limit']);_0x46bc65[_0xfc98('0x2f')]=qs['offset'](_0x5b921c['query'][_0xfc98('0x2f')]);}return _0x3b96f6[_0xfc98('0x5d')](_0x46bc65);}})[_0xfc98('0x20')](function(_0x6d1ecd){if(_0x6d1ecd){return _0x6d1ecd?{'count':_0x5b9f6e,'rows':_0x6d1ecd}:null;}})[_0xfc98('0x20')](respondWithResult(_0x4d846f,null))[_0xfc98('0x2a')](handleError(_0x4d846f,null));};
\ No newline at end of file
+var _0x293b=['length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','getFields','findOne','keys','order','nolimit','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields'];(function(_0x61909f,_0x1afdea){var _0x4ad05e=function(_0x1380a0){while(--_0x1380a0){_0x61909f['push'](_0x61909f['shift']());}};_0x4ad05e(++_0x1afdea);}(_0x293b,0x159));var _0xb293=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x293b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb293('0x0'));var rimraf=require(_0xb293('0x1'));var zipdir=require(_0xb293('0x2'));var jsonpatch=require(_0xb293('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb293('0x4'));var Mustache=require(_0xb293('0x5'));var util=require('util');var path=require(_0xb293('0x6'));var sox=require(_0xb293('0x7'));var csv=require(_0xb293('0x8'));var ejs=require(_0xb293('0x9'));var fs=require('fs');var fs_extra=require(_0xb293('0xa'));var _=require('lodash');var squel=require(_0xb293('0xb'));var crypto=require(_0xb293('0xc'));var jsforce=require(_0xb293('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb293('0x8'));var querystring=require(_0xb293('0xe'));var Papa=require('papaparse');var Redis=require(_0xb293('0xf'));var authService=require(_0xb293('0x10'));var qs=require(_0xb293('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb293('0x12'));var logger=require(_0xb293('0x13'))(_0xb293('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb293('0x15'));var db=require(_0xb293('0x16'))['db'];function respondWithStatusCode(_0x36443d,_0x1c7f88){_0x1c7f88=_0x1c7f88||0xcc;return function(_0x4d0fed){if(_0x4d0fed){return _0x36443d[_0xb293('0x17')](_0x1c7f88);}return _0x36443d[_0xb293('0x18')](_0x1c7f88)[_0xb293('0x19')]();};}function respondWithResult(_0x2c4300,_0x4ff712){_0x4ff712=_0x4ff712||0xc8;return function(_0x1866c6){if(_0x1866c6){return _0x2c4300[_0xb293('0x18')](_0x4ff712)['json'](_0x1866c6);}};}function respondWithFilteredResult(_0x493dc1,_0x33db46){return function(_0x47a364){if(_0x47a364){var _0x52fb25=typeof _0x33db46[_0xb293('0x1a')]===_0xb293('0x1b')&&typeof _0x33db46[_0xb293('0x1c')]==='undefined';var _0x47f00f=_0x47a364[_0xb293('0x1d')];var _0x73870c=_0x52fb25?0x0:_0x33db46[_0xb293('0x1a')];var _0x144587=_0x52fb25?_0x47a364[_0xb293('0x1d')]:_0x33db46[_0xb293('0x1a')]+_0x33db46[_0xb293('0x1c')];var _0x39c982;if(_0x144587>=_0x47f00f){_0x144587=_0x47f00f;_0x39c982=0xc8;}else{_0x39c982=0xce;}_0x493dc1[_0xb293('0x18')](_0x39c982);return _0x493dc1[_0xb293('0x1e')](_0xb293('0x1f'),_0x73870c+'-'+_0x144587+'/'+_0x47f00f)[_0xb293('0x20')](_0x47a364);}return null;};}function patchUpdates(_0x2ada7a){return function(_0x19793c){try{jsonpatch[_0xb293('0x21')](_0x19793c,_0x2ada7a,!![]);}catch(_0x502fa2){return BPromise[_0xb293('0x22')](_0x502fa2);}return _0x19793c[_0xb293('0x23')]();};}function saveUpdates(_0x5f3eb8,_0x5f3900){return function(_0x51edd6){if(_0x51edd6){return _0x51edd6[_0xb293('0x24')](_0x5f3eb8)[_0xb293('0x25')](function(_0x3e827f){return _0x3e827f;});}return null;};}function removeEntity(_0x54a805,_0x537c7d){return function(_0x2a7575){if(_0x2a7575){return _0x2a7575[_0xb293('0x26')]()[_0xb293('0x25')](function(){_0x54a805[_0xb293('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x134bf5,_0x10aaa6){return function(_0x54297b){if(!_0x54297b){_0x134bf5['sendStatus'](0x194);}return _0x54297b;};}function handleError(_0x15390f,_0xcb8f54){_0xcb8f54=_0xcb8f54||0x1f4;return function(_0x443980){logger[_0xb293('0x27')](_0x443980['stack']);if(_0x443980[_0xb293('0x28')]){delete _0x443980[_0xb293('0x28')];}_0x15390f[_0xb293('0x18')](_0xcb8f54)[_0xb293('0x29')](_0x443980);};}exports[_0xb293('0x2a')]=function(_0x52f9e7,_0xc7abad){var _0x3c2994={},_0x3cad7f={},_0x543d39={'count':0x0,'rows':[]};var _0x2c4cef=_[_0xb293('0x2b')](db[_0xb293('0x2c')][_0xb293('0x2d')],function(_0x19d2ba){return{'name':_0x19d2ba[_0xb293('0x2e')],'type':_0x19d2ba[_0xb293('0x2f')][_0xb293('0x30')]};});_0x3cad7f['model']=_[_0xb293('0x2b')](_0x2c4cef,_0xb293('0x28'));_0x3cad7f[_0xb293('0x31')]=_['keys'](_0x52f9e7[_0xb293('0x31')]);_0x3cad7f[_0xb293('0x32')]=_[_0xb293('0x33')](_0x3cad7f[_0xb293('0x34')],_0x3cad7f['query']);_0x3c2994[_0xb293('0x35')]=_[_0xb293('0x33')](_0x3cad7f[_0xb293('0x34')],qs[_0xb293('0x36')](_0x52f9e7[_0xb293('0x31')][_0xb293('0x36')]));_0x3c2994[_0xb293('0x35')]=_0x3c2994[_0xb293('0x35')][_0xb293('0x37')]?_0x3c2994[_0xb293('0x35')]:_0x3cad7f['model'];if(!_0x52f9e7[_0xb293('0x31')][_0xb293('0x38')]('nolimit')){_0x3c2994[_0xb293('0x1c')]=qs[_0xb293('0x1c')](_0x52f9e7[_0xb293('0x31')][_0xb293('0x1c')]);_0x3c2994[_0xb293('0x1a')]=qs[_0xb293('0x1a')](_0x52f9e7[_0xb293('0x31')]['offset']);}_0x3c2994['order']=qs[_0xb293('0x39')](_0x52f9e7[_0xb293('0x31')]['sort']);_0x3c2994[_0xb293('0x3a')]=qs[_0xb293('0x32')](_[_0xb293('0x3b')](_0x52f9e7[_0xb293('0x31')],_0x3cad7f[_0xb293('0x32')]),_0x2c4cef);if(_0x52f9e7[_0xb293('0x31')][_0xb293('0x3c')]){_0x3c2994[_0xb293('0x3a')]=_[_0xb293('0x3d')](_0x3c2994['where'],{'$or':_[_0xb293('0x2b')](_0x2c4cef,function(_0x25f89b){if(_0x25f89b[_0xb293('0x2f')]!==_0xb293('0x3e')){var _0x197ebf={};_0x197ebf[_0x25f89b[_0xb293('0x28')]]={'$like':'%'+_0x52f9e7[_0xb293('0x31')][_0xb293('0x3c')]+'%'};return _0x197ebf;}})});}_0x3c2994=_['merge']({},_0x3c2994,_0x52f9e7[_0xb293('0x3f')]);var _0x48e7b4={'where':_0x3c2994[_0xb293('0x3a')]};return db[_0xb293('0x2c')][_0xb293('0x1d')](_0x48e7b4)[_0xb293('0x25')](function(_0x21f8e6){_0x543d39[_0xb293('0x1d')]=_0x21f8e6;if(_0x52f9e7['query'][_0xb293('0x40')]){_0x3c2994[_0xb293('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xb293('0x42')](_0x3c2994);})[_0xb293('0x25')](function(_0x5d7c3d){_0x543d39['rows']=_0x5d7c3d;return _0x543d39;})[_0xb293('0x25')](respondWithFilteredResult(_0xc7abad,_0x3c2994))[_0xb293('0x43')](handleError(_0xc7abad,null));};exports['show']=function(_0x2b9578,_0xca76a2){var _0x4be61a={'raw':![],'where':{'id':_0x2b9578[_0xb293('0x44')]['id']}},_0xf1db6={};_0xf1db6['model']=_['keys'](db[_0xb293('0x2c')]['rawAttributes']);_0xf1db6[_0xb293('0x31')]=_['keys'](_0x2b9578['query']);_0xf1db6[_0xb293('0x32')]=_['intersection'](_0xf1db6[_0xb293('0x34')],_0xf1db6['query']);_0x4be61a[_0xb293('0x35')]=_[_0xb293('0x33')](_0xf1db6['model'],qs[_0xb293('0x36')](_0x2b9578[_0xb293('0x31')][_0xb293('0x36')]));_0x4be61a[_0xb293('0x35')]=_0x4be61a[_0xb293('0x35')][_0xb293('0x37')]?_0x4be61a[_0xb293('0x35')]:_0xf1db6[_0xb293('0x34')];if(_0x2b9578[_0xb293('0x31')]['includeAll']){_0x4be61a[_0xb293('0x41')]=[{'all':!![]}];}_0x4be61a=_[_0xb293('0x3d')]({},_0x4be61a,_0x2b9578[_0xb293('0x3f')]);return db['Dynamics365Configuration'][_0xb293('0x45')](_0x4be61a)[_0xb293('0x25')](handleEntityNotFound(_0xca76a2,null))[_0xb293('0x25')](respondWithResult(_0xca76a2,null))[_0xb293('0x43')](handleError(_0xca76a2,null));};exports[_0xb293('0x46')]=function(_0x437e9d,_0x1f8077){return db['Dynamics365Configuration'][_0xb293('0x46')](_0x437e9d[_0xb293('0x47')],{})['then'](respondWithResult(_0x1f8077,0xc9))[_0xb293('0x43')](handleError(_0x1f8077,null));};exports[_0xb293('0x24')]=function(_0x17d8f6,_0x33a1b9){if(_0x17d8f6[_0xb293('0x47')]['id']){delete _0x17d8f6[_0xb293('0x47')]['id'];}return db['Dynamics365Configuration'][_0xb293('0x45')]({'where':{'id':_0x17d8f6[_0xb293('0x44')]['id']}})[_0xb293('0x25')](handleEntityNotFound(_0x33a1b9,null))[_0xb293('0x25')](saveUpdates(_0x17d8f6[_0xb293('0x47')],null))[_0xb293('0x25')](respondWithResult(_0x33a1b9,null))[_0xb293('0x43')](handleError(_0x33a1b9,null));};exports['destroy']=function(_0x1889f6,_0x120932){return db['Dynamics365Configuration'][_0xb293('0x45')]({'where':{'id':_0x1889f6[_0xb293('0x44')]['id']}})[_0xb293('0x25')](handleEntityNotFound(_0x120932,null))[_0xb293('0x25')](removeEntity(_0x120932,null))[_0xb293('0x43')](handleError(_0x120932,null));};exports[_0xb293('0x48')]=function(_0x65a2d6,_0x48e399,_0x3b6c58){var _0x2e1e44={};var _0x3adef1={};var _0x255403;var _0x318e3e;return db['Dynamics365Configuration'][_0xb293('0x49')]({'where':{'id':_0x65a2d6[_0xb293('0x44')]['id']}})['then'](handleEntityNotFound(_0x48e399,null))['then'](function(_0x4827d4){if(_0x4827d4){_0x255403=_0x4827d4;_0x3adef1[_0xb293('0x34')]=_[_0xb293('0x4a')](db['Dynamics365Field'][_0xb293('0x2d')]);_0x3adef1[_0xb293('0x31')]=_[_0xb293('0x4a')](_0x65a2d6[_0xb293('0x31')]);_0x3adef1['filters']=_['intersection'](_0x3adef1['model'],_0x3adef1[_0xb293('0x31')]);_0x2e1e44['attributes']=_[_0xb293('0x33')](_0x3adef1[_0xb293('0x34')],qs[_0xb293('0x36')](_0x65a2d6['query'][_0xb293('0x36')]));_0x2e1e44[_0xb293('0x35')]=_0x2e1e44[_0xb293('0x35')][_0xb293('0x37')]?_0x2e1e44[_0xb293('0x35')]:_0x3adef1['model'];_0x2e1e44[_0xb293('0x4b')]=qs[_0xb293('0x39')](_0x65a2d6[_0xb293('0x31')][_0xb293('0x39')]);_0x2e1e44[_0xb293('0x3a')]=qs[_0xb293('0x32')](_[_0xb293('0x3b')](_0x65a2d6[_0xb293('0x31')],_0x3adef1[_0xb293('0x32')]));if(_0x65a2d6[_0xb293('0x31')][_0xb293('0x3c')]){_0x2e1e44[_0xb293('0x3a')]=_[_0xb293('0x3d')](_0x2e1e44['where'],{'$or':_['map'](_0x2e1e44[_0xb293('0x35')],function(_0x1cc512){var _0x585fed={};_0x585fed[_0x1cc512]={'$like':'%'+_0x65a2d6['query'][_0xb293('0x3c')]+'%'};return _0x585fed;})});}_0x2e1e44=_['merge']({},_0x2e1e44,_0x65a2d6[_0xb293('0x3f')]);return _0x255403[_0xb293('0x48')](_0x2e1e44);}})['then'](function(_0x2909aa){if(_0x2909aa){_0x318e3e=_0x2909aa[_0xb293('0x37')];if(!_0x65a2d6['query'][_0xb293('0x38')](_0xb293('0x4c'))){_0x2e1e44['limit']=qs[_0xb293('0x1c')](_0x65a2d6[_0xb293('0x31')][_0xb293('0x1c')]);_0x2e1e44[_0xb293('0x1a')]=qs[_0xb293('0x1a')](_0x65a2d6['query'][_0xb293('0x1a')]);}return _0x255403[_0xb293('0x48')](_0x2e1e44);}})[_0xb293('0x25')](function(_0x462106){if(_0x462106){return _0x462106?{'count':_0x318e3e,'rows':_0x462106}:null;}})[_0xb293('0x25')](respondWithResult(_0x48e399,null))[_0xb293('0x43')](handleError(_0x48e399,null));};exports['getSubjects']=function(_0x2c68af,_0x20d10c,_0x1c8283){var _0x17212a={};var _0x3efb46={};var _0x24f843;var _0x487dad;return db[_0xb293('0x2c')][_0xb293('0x49')]({'where':{'id':_0x2c68af['params']['id']}})[_0xb293('0x25')](handleEntityNotFound(_0x20d10c,null))['then'](function(_0x4a28c5){if(_0x4a28c5){_0x24f843=_0x4a28c5;_0x3efb46[_0xb293('0x34')]=_[_0xb293('0x4a')](db['Dynamics365Field'][_0xb293('0x2d')]);_0x3efb46[_0xb293('0x31')]=_[_0xb293('0x4a')](_0x2c68af[_0xb293('0x31')]);_0x3efb46[_0xb293('0x32')]=_[_0xb293('0x33')](_0x3efb46['model'],_0x3efb46[_0xb293('0x31')]);_0x17212a[_0xb293('0x35')]=_[_0xb293('0x33')](_0x3efb46[_0xb293('0x34')],qs[_0xb293('0x36')](_0x2c68af[_0xb293('0x31')][_0xb293('0x36')]));_0x17212a[_0xb293('0x35')]=_0x17212a[_0xb293('0x35')][_0xb293('0x37')]?_0x17212a[_0xb293('0x35')]:_0x3efb46[_0xb293('0x34')];_0x17212a[_0xb293('0x4b')]=qs[_0xb293('0x39')](_0x2c68af[_0xb293('0x31')]['sort']);_0x17212a[_0xb293('0x3a')]=qs[_0xb293('0x32')](_['pick'](_0x2c68af['query'],_0x3efb46[_0xb293('0x32')]));if(_0x2c68af['query'][_0xb293('0x3c')]){_0x17212a[_0xb293('0x3a')]=_[_0xb293('0x3d')](_0x17212a['where'],{'$or':_[_0xb293('0x2b')](_0x17212a[_0xb293('0x35')],function(_0x54fac5){var _0x5581bd={};_0x5581bd[_0x54fac5]={'$like':'%'+_0x2c68af['query'][_0xb293('0x3c')]+'%'};return _0x5581bd;})});}_0x17212a=_[_0xb293('0x3d')]({},_0x17212a,_0x2c68af[_0xb293('0x3f')]);return _0x24f843[_0xb293('0x4d')](_0x17212a);}})[_0xb293('0x25')](function(_0x2e4b16){if(_0x2e4b16){_0x487dad=_0x2e4b16['length'];if(!_0x2c68af[_0xb293('0x31')][_0xb293('0x38')]('nolimit')){_0x17212a['limit']=qs[_0xb293('0x1c')](_0x2c68af[_0xb293('0x31')][_0xb293('0x1c')]);_0x17212a[_0xb293('0x1a')]=qs[_0xb293('0x1a')](_0x2c68af[_0xb293('0x31')][_0xb293('0x1a')]);}return _0x24f843[_0xb293('0x4d')](_0x17212a);}})[_0xb293('0x25')](function(_0xdac436){if(_0xdac436){return _0xdac436?{'count':_0x487dad,'rows':_0xdac436}:null;}})[_0xb293('0x25')](respondWithResult(_0x20d10c,null))[_0xb293('0x43')](handleError(_0x20d10c,null));};exports[_0xb293('0x4e')]=function(_0xa74624,_0x1d45f9,_0x20edb5){var _0x55db66={};var _0x391c08={};var _0x44cb68;var _0x5979d0;return db[_0xb293('0x2c')][_0xb293('0x49')]({'where':{'id':_0xa74624[_0xb293('0x44')]['id']}})[_0xb293('0x25')](handleEntityNotFound(_0x1d45f9,null))['then'](function(_0x4adf54){if(_0x4adf54){_0x44cb68=_0x4adf54;_0x391c08[_0xb293('0x34')]=_[_0xb293('0x4a')](db[_0xb293('0x4f')][_0xb293('0x2d')]);_0x391c08[_0xb293('0x31')]=_['keys'](_0xa74624[_0xb293('0x31')]);_0x391c08[_0xb293('0x32')]=_['intersection'](_0x391c08[_0xb293('0x34')],_0x391c08['query']);_0x55db66['attributes']=_[_0xb293('0x33')](_0x391c08[_0xb293('0x34')],qs['fields'](_0xa74624[_0xb293('0x31')]['fields']));_0x55db66[_0xb293('0x35')]=_0x55db66[_0xb293('0x35')][_0xb293('0x37')]?_0x55db66[_0xb293('0x35')]:_0x391c08['model'];_0x55db66[_0xb293('0x4b')]=qs[_0xb293('0x39')](_0xa74624[_0xb293('0x31')]['sort']);_0x55db66[_0xb293('0x3a')]=qs[_0xb293('0x32')](_[_0xb293('0x3b')](_0xa74624[_0xb293('0x31')],_0x391c08[_0xb293('0x32')]));if(_0xa74624[_0xb293('0x31')][_0xb293('0x3c')]){_0x55db66[_0xb293('0x3a')]=_[_0xb293('0x3d')](_0x55db66[_0xb293('0x3a')],{'$or':_['map'](_0x55db66['attributes'],function(_0x1a2127){var _0x2223f0={};_0x2223f0[_0x1a2127]={'$like':'%'+_0xa74624[_0xb293('0x31')]['filter']+'%'};return _0x2223f0;})});}_0x55db66=_[_0xb293('0x3d')]({},_0x55db66,_0xa74624[_0xb293('0x3f')]);return _0x44cb68[_0xb293('0x4e')](_0x55db66);}})[_0xb293('0x25')](function(_0x4f35e9){if(_0x4f35e9){_0x5979d0=_0x4f35e9[_0xb293('0x37')];if(!_0xa74624['query']['hasOwnProperty'](_0xb293('0x4c'))){_0x55db66['limit']=qs['limit'](_0xa74624['query'][_0xb293('0x1c')]);_0x55db66[_0xb293('0x1a')]=qs[_0xb293('0x1a')](_0xa74624[_0xb293('0x31')][_0xb293('0x1a')]);}return _0x44cb68[_0xb293('0x4e')](_0x55db66);}})[_0xb293('0x25')](function(_0x3d002c){if(_0x3d002c){return _0x3d002c?{'count':_0x5979d0,'rows':_0x3d002c}:null;}})[_0xb293('0x25')](respondWithResult(_0x1d45f9,null))[_0xb293('0x43')](handleError(_0x1d45f9,null));};
\ No newline at end of file