Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / api / intDynamics365Configuration / intDynamics365Configuration.controller.js
index f9c26b7..9a23fbc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f73=['ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','reject','save','end','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','create','body','update','destroy','findOne','pick','nolimit','getFields','getSubjects','Dynamics365Field','order','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse'];(function(_0x267eb8,_0x1dab7a){var _0x570b4d=function(_0x55c01e){while(--_0x55c01e){_0x267eb8['push'](_0x267eb8['shift']());}};_0x570b4d(++_0x1dab7a);}(_0x9f73,0xfb));var _0x39f7=function(_0x2d2b68,_0x5346ad){_0x2d2b68=_0x2d2b68-0x0;var _0x16bcb7=_0x9f73[_0x2d2b68];return _0x16bcb7;};'use strict';var pdf=require(_0x39f7('0x0'));var emlformat=require(_0x39f7('0x1'));var rimraf=require(_0x39f7('0x2'));var zipdir=require(_0x39f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39f7('0x4'));var moment=require(_0x39f7('0x5'));var BPromise=require(_0x39f7('0x6'));var Mustache=require(_0x39f7('0x7'));var util=require(_0x39f7('0x8'));var path=require('path');var sox=require(_0x39f7('0x9'));var csv=require(_0x39f7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x39f7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x39f7('0xc'));var deskjs=require(_0x39f7('0xd'));var toCsv=require(_0x39f7('0xa'));var querystring=require(_0x39f7('0xe'));var Papa=require(_0x39f7('0xf'));var Redis=require(_0x39f7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x39f7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x39f7('0x12'));var utils=require(_0x39f7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x39f7('0x14'));var db=require(_0x39f7('0x15'))['db'];var jayson=require(_0x39f7('0x16'));var client=jayson[_0x39f7('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14b099,_0x59339e,_0xfdff54,_0x2e1d68){return new BPromise(function(_0x980699,_0x1e5d0b){var _0x21cdb8=_0x2e1d68||client;return _0x21cdb8[_0x39f7('0x18')](_0x14b099,_0xfdff54)[_0x39f7('0x19')](function(_0x2c6945){logger[_0x39f7('0x1a')](_0x39f7('0x1b'),_0x59339e,_0x39f7('0x1c'));logger[_0x39f7('0x1d')](_0x39f7('0x1e'),_0x59339e,_0x39f7('0x1c'),JSON[_0x39f7('0x1f')](_0x2c6945));if(_0x2c6945[_0x39f7('0x20')]){if(_0x2c6945[_0x39f7('0x20')][_0x39f7('0x21')]===0x1f4){logger[_0x39f7('0x20')](_0x39f7('0x1b'),_0x59339e,_0x2c6945[_0x39f7('0x20')][_0x39f7('0x22')]);return _0x1e5d0b(_0x2c6945[_0x39f7('0x20')][_0x39f7('0x22')]);}logger[_0x39f7('0x20')](_0x39f7('0x1b'),_0x59339e,_0x2c6945[_0x39f7('0x20')][_0x39f7('0x22')]);return _0x980699(_0x2c6945[_0x39f7('0x20')]['message']);}else{logger['info'](_0x39f7('0x1b'),_0x59339e,_0x39f7('0x1c'));_0x980699(_0x2c6945[_0x39f7('0x23')][_0x39f7('0x22')]);}})[_0x39f7('0x24')](function(_0x54107b){logger[_0x39f7('0x20')](_0x39f7('0x1b'),_0x59339e,_0x54107b);_0x1e5d0b(_0x54107b);});});}function respondWithStatusCode(_0x280489,_0x55c4c5){_0x55c4c5=_0x55c4c5||0xcc;return function(_0x84d6b0){if(_0x84d6b0){return _0x280489[_0x39f7('0x25')](_0x55c4c5);}return _0x280489[_0x39f7('0x26')](_0x55c4c5)['end']();};}function respondWithResult(_0x19fb49,_0xab4222){_0xab4222=_0xab4222||0xc8;return function(_0x2ec370){if(_0x2ec370){return _0x19fb49['status'](_0xab4222)[_0x39f7('0x27')](_0x2ec370);}};}function respondWithFilteredResult(_0x355614,_0x422280){return function(_0x600ddf){if(_0x600ddf){var _0x3e2d80=_0x600ddf[_0x39f7('0x28')],_0x236c59=_0x422280[_0x39f7('0x29')],_0x2903e5=_0x422280[_0x39f7('0x29')]+_0x422280[_0x39f7('0x2a')],_0x335fae;if(_0x2903e5>=_0x3e2d80){_0x2903e5=_0x3e2d80;_0x335fae=0xc8;}else{_0x335fae=0xce;}_0x355614[_0x39f7('0x26')](_0x335fae);return _0x355614['set']('Content-Range',_0x236c59+'-'+_0x2903e5+'/'+_0x3e2d80)[_0x39f7('0x27')](_0x600ddf);}return null;};}function patchUpdates(_0x1c79b3){return function(_0x2a624a){try{jsonpatch['apply'](_0x2a624a,_0x1c79b3,!![]);}catch(_0x3ab137){return BPromise[_0x39f7('0x2b')](_0x3ab137);}return _0x2a624a[_0x39f7('0x2c')]();};}function saveUpdates(_0x327f36,_0x2bd515){return function(_0x4592b0){if(_0x4592b0){return _0x4592b0['update'](_0x327f36)[_0x39f7('0x19')](function(_0x24fc2e){return _0x24fc2e;});}return null;};}function removeEntity(_0x49e8f6,_0x286f29){return function(_0x5de90f){if(_0x5de90f){return _0x5de90f['destroy']()[_0x39f7('0x19')](function(){_0x49e8f6[_0x39f7('0x26')](0xcc)[_0x39f7('0x2d')]();});}};}function handleEntityNotFound(_0x25e4a4,_0x227a59){return function(_0x398dd0){if(!_0x398dd0){_0x25e4a4[_0x39f7('0x25')](0x194);}return _0x398dd0;};}function handleError(_0x3b72e3,_0x49538d){_0x49538d=_0x49538d||0x1f4;return function(_0x43e61f){logger['error'](_0x43e61f[_0x39f7('0x2e')]);if(_0x43e61f[_0x39f7('0x2f')]){delete _0x43e61f[_0x39f7('0x2f')];}_0x3b72e3[_0x39f7('0x26')](_0x49538d)[_0x39f7('0x30')](_0x43e61f);};}exports[_0x39f7('0x31')]=function(_0x166a8b,_0x26011c){var _0x111e2c={},_0xb5b978={},_0x246f18={'count':0x0,'rows':[]};var _0x26c782=_[_0x39f7('0x32')](db[_0x39f7('0x33')][_0x39f7('0x34')],function(_0x1a0f18){return{'name':_0x1a0f18[_0x39f7('0x35')],'type':_0x1a0f18[_0x39f7('0x36')]['key']};});_0xb5b978['model']=_[_0x39f7('0x32')](_0x26c782,_0x39f7('0x2f'));_0xb5b978[_0x39f7('0x37')]=_[_0x39f7('0x38')](_0x166a8b[_0x39f7('0x37')]);_0xb5b978[_0x39f7('0x39')]=_[_0x39f7('0x3a')](_0xb5b978[_0x39f7('0x3b')],_0xb5b978[_0x39f7('0x37')]);_0x111e2c[_0x39f7('0x3c')]=_[_0x39f7('0x3a')](_0xb5b978[_0x39f7('0x3b')],qs[_0x39f7('0x3d')](_0x166a8b[_0x39f7('0x37')][_0x39f7('0x3d')]));_0x111e2c['attributes']=_0x111e2c[_0x39f7('0x3c')][_0x39f7('0x3e')]?_0x111e2c['attributes']:_0xb5b978[_0x39f7('0x3b')];if(!_0x166a8b[_0x39f7('0x37')][_0x39f7('0x3f')]('nolimit')){_0x111e2c[_0x39f7('0x2a')]=qs[_0x39f7('0x2a')](_0x166a8b[_0x39f7('0x37')][_0x39f7('0x2a')]);_0x111e2c[_0x39f7('0x29')]=qs['offset'](_0x166a8b[_0x39f7('0x37')][_0x39f7('0x29')]);}_0x111e2c['order']=qs[_0x39f7('0x40')](_0x166a8b['query']['sort']);_0x111e2c[_0x39f7('0x41')]=qs[_0x39f7('0x39')](_['pick'](_0x166a8b[_0x39f7('0x37')],_0xb5b978['filters']),_0x26c782);if(_0x166a8b[_0x39f7('0x37')]['filter']){_0x111e2c[_0x39f7('0x41')]=_[_0x39f7('0x42')](_0x111e2c[_0x39f7('0x41')],{'$or':_[_0x39f7('0x32')](_0x26c782,function(_0x5daf0d){if(_0x5daf0d[_0x39f7('0x36')]!==_0x39f7('0x43')){var _0x575a07={};_0x575a07[_0x5daf0d[_0x39f7('0x2f')]]={'$like':'%'+_0x166a8b[_0x39f7('0x37')][_0x39f7('0x44')]+'%'};return _0x575a07;}})});}_0x111e2c=_['merge']({},_0x111e2c,_0x166a8b['options']);var _0x9dbbff={'where':_0x111e2c[_0x39f7('0x41')]};return db['Dynamics365Configuration'][_0x39f7('0x28')](_0x9dbbff)['then'](function(_0x5e0334){_0x246f18['count']=_0x5e0334;if(_0x166a8b[_0x39f7('0x37')][_0x39f7('0x45')]){_0x111e2c[_0x39f7('0x46')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x39f7('0x47')](_0x111e2c);})[_0x39f7('0x19')](function(_0x1a3bbf){_0x246f18[_0x39f7('0x48')]=_0x1a3bbf;return _0x246f18;})['then'](respondWithFilteredResult(_0x26011c,_0x111e2c))['catch'](handleError(_0x26011c,null));};exports[_0x39f7('0x49')]=function(_0x3c1e4f,_0x4a4db4){var _0x44140e={'raw':![],'where':{'id':_0x3c1e4f[_0x39f7('0x4a')]['id']}},_0x71be0c={};_0x71be0c[_0x39f7('0x3b')]=_[_0x39f7('0x38')](db['Dynamics365Configuration']['rawAttributes']);_0x71be0c[_0x39f7('0x37')]=_[_0x39f7('0x38')](_0x3c1e4f[_0x39f7('0x37')]);_0x71be0c['filters']=_[_0x39f7('0x3a')](_0x71be0c['model'],_0x71be0c[_0x39f7('0x37')]);_0x44140e['attributes']=_[_0x39f7('0x3a')](_0x71be0c['model'],qs['fields'](_0x3c1e4f[_0x39f7('0x37')][_0x39f7('0x3d')]));_0x44140e[_0x39f7('0x3c')]=_0x44140e[_0x39f7('0x3c')][_0x39f7('0x3e')]?_0x44140e['attributes']:_0x71be0c[_0x39f7('0x3b')];if(_0x3c1e4f[_0x39f7('0x37')][_0x39f7('0x45')]){_0x44140e['include']=[{'all':!![]}];}_0x44140e=_['merge']({},_0x44140e,_0x3c1e4f[_0x39f7('0x4b')]);return db['Dynamics365Configuration'][_0x39f7('0x4c')](_0x44140e)['then'](handleEntityNotFound(_0x4a4db4,null))[_0x39f7('0x19')](respondWithResult(_0x4a4db4,null))[_0x39f7('0x24')](handleError(_0x4a4db4,null));};exports[_0x39f7('0x4d')]=function(_0x43a685,_0x39b714){return db[_0x39f7('0x33')][_0x39f7('0x4d')](_0x43a685[_0x39f7('0x4e')],{})['then'](respondWithResult(_0x39b714,0xc9))[_0x39f7('0x24')](handleError(_0x39b714,null));};exports[_0x39f7('0x4f')]=function(_0x18affd,_0x1c76ce){if(_0x18affd[_0x39f7('0x4e')]['id']){delete _0x18affd[_0x39f7('0x4e')]['id'];}return db[_0x39f7('0x33')]['find']({'where':{'id':_0x18affd[_0x39f7('0x4a')]['id']}})[_0x39f7('0x19')](handleEntityNotFound(_0x1c76ce,null))[_0x39f7('0x19')](saveUpdates(_0x18affd['body'],null))[_0x39f7('0x19')](respondWithResult(_0x1c76ce,null))[_0x39f7('0x24')](handleError(_0x1c76ce,null));};exports[_0x39f7('0x50')]=function(_0x52dd89,_0x191307){return db[_0x39f7('0x33')][_0x39f7('0x4c')]({'where':{'id':_0x52dd89[_0x39f7('0x4a')]['id']}})[_0x39f7('0x19')](handleEntityNotFound(_0x191307,null))[_0x39f7('0x19')](removeEntity(_0x191307,null))[_0x39f7('0x24')](handleError(_0x191307,null));};exports['getFields']=function(_0x26d472,_0x2247db,_0x7fa0f1){var _0xe52625={};var _0x4684ec={};var _0x397382;var _0x1c05bd;return db[_0x39f7('0x33')][_0x39f7('0x51')]({'where':{'id':_0x26d472[_0x39f7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2247db,null))[_0x39f7('0x19')](function(_0x7931e3){if(_0x7931e3){_0x397382=_0x7931e3;_0x4684ec[_0x39f7('0x3b')]=_[_0x39f7('0x38')](db['Dynamics365Field'][_0x39f7('0x34')]);_0x4684ec['query']=_[_0x39f7('0x38')](_0x26d472[_0x39f7('0x37')]);_0x4684ec[_0x39f7('0x39')]=_[_0x39f7('0x3a')](_0x4684ec[_0x39f7('0x3b')],_0x4684ec[_0x39f7('0x37')]);_0xe52625['attributes']=_[_0x39f7('0x3a')](_0x4684ec[_0x39f7('0x3b')],qs[_0x39f7('0x3d')](_0x26d472[_0x39f7('0x37')][_0x39f7('0x3d')]));_0xe52625[_0x39f7('0x3c')]=_0xe52625[_0x39f7('0x3c')][_0x39f7('0x3e')]?_0xe52625['attributes']:_0x4684ec['model'];_0xe52625['order']=qs[_0x39f7('0x40')](_0x26d472[_0x39f7('0x37')][_0x39f7('0x40')]);_0xe52625[_0x39f7('0x41')]=qs[_0x39f7('0x39')](_[_0x39f7('0x52')](_0x26d472['query'],_0x4684ec[_0x39f7('0x39')]));if(_0x26d472[_0x39f7('0x37')][_0x39f7('0x44')]){_0xe52625[_0x39f7('0x41')]=_['merge'](_0xe52625[_0x39f7('0x41')],{'$or':_[_0x39f7('0x32')](_0xe52625[_0x39f7('0x3c')],function(_0xe2c32c){var _0x195908={};_0x195908[_0xe2c32c]={'$like':'%'+_0x26d472[_0x39f7('0x37')][_0x39f7('0x44')]+'%'};return _0x195908;})});}_0xe52625=_[_0x39f7('0x42')]({},_0xe52625,_0x26d472['options']);return _0x397382['getFields'](_0xe52625);}})[_0x39f7('0x19')](function(_0x170974){if(_0x170974){_0x1c05bd=_0x170974[_0x39f7('0x3e')];if(!_0x26d472[_0x39f7('0x37')][_0x39f7('0x3f')](_0x39f7('0x53'))){_0xe52625[_0x39f7('0x2a')]=qs[_0x39f7('0x2a')](_0x26d472['query'][_0x39f7('0x2a')]);_0xe52625['offset']=qs[_0x39f7('0x29')](_0x26d472['query'][_0x39f7('0x29')]);}return _0x397382[_0x39f7('0x54')](_0xe52625);}})['then'](function(_0x45fd1e){if(_0x45fd1e){return _0x45fd1e?{'count':_0x1c05bd,'rows':_0x45fd1e}:null;}})[_0x39f7('0x19')](respondWithResult(_0x2247db,null))['catch'](handleError(_0x2247db,null));};exports[_0x39f7('0x55')]=function(_0x13b69d,_0x484653,_0x5e7577){var _0x5d483b={};var _0x283d8d={};var _0x25cbf0;var _0x3783c0;return db[_0x39f7('0x33')][_0x39f7('0x51')]({'where':{'id':_0x13b69d[_0x39f7('0x4a')]['id']}})[_0x39f7('0x19')](handleEntityNotFound(_0x484653,null))[_0x39f7('0x19')](function(_0x50d82f){if(_0x50d82f){_0x25cbf0=_0x50d82f;_0x283d8d[_0x39f7('0x3b')]=_['keys'](db[_0x39f7('0x56')][_0x39f7('0x34')]);_0x283d8d[_0x39f7('0x37')]=_['keys'](_0x13b69d[_0x39f7('0x37')]);_0x283d8d[_0x39f7('0x39')]=_[_0x39f7('0x3a')](_0x283d8d[_0x39f7('0x3b')],_0x283d8d[_0x39f7('0x37')]);_0x5d483b['attributes']=_[_0x39f7('0x3a')](_0x283d8d['model'],qs[_0x39f7('0x3d')](_0x13b69d[_0x39f7('0x37')][_0x39f7('0x3d')]));_0x5d483b[_0x39f7('0x3c')]=_0x5d483b[_0x39f7('0x3c')][_0x39f7('0x3e')]?_0x5d483b[_0x39f7('0x3c')]:_0x283d8d[_0x39f7('0x3b')];_0x5d483b[_0x39f7('0x57')]=qs[_0x39f7('0x40')](_0x13b69d[_0x39f7('0x37')][_0x39f7('0x40')]);_0x5d483b[_0x39f7('0x41')]=qs[_0x39f7('0x39')](_['pick'](_0x13b69d[_0x39f7('0x37')],_0x283d8d[_0x39f7('0x39')]));if(_0x13b69d[_0x39f7('0x37')][_0x39f7('0x44')]){_0x5d483b[_0x39f7('0x41')]=_[_0x39f7('0x42')](_0x5d483b['where'],{'$or':_[_0x39f7('0x32')](_0x5d483b[_0x39f7('0x3c')],function(_0xeb21e5){var _0x5e55c4={};_0x5e55c4[_0xeb21e5]={'$like':'%'+_0x13b69d[_0x39f7('0x37')][_0x39f7('0x44')]+'%'};return _0x5e55c4;})});}_0x5d483b=_[_0x39f7('0x42')]({},_0x5d483b,_0x13b69d[_0x39f7('0x4b')]);return _0x25cbf0[_0x39f7('0x55')](_0x5d483b);}})['then'](function(_0x372483){if(_0x372483){_0x3783c0=_0x372483[_0x39f7('0x3e')];if(!_0x13b69d['query'][_0x39f7('0x3f')](_0x39f7('0x53'))){_0x5d483b[_0x39f7('0x2a')]=qs['limit'](_0x13b69d[_0x39f7('0x37')][_0x39f7('0x2a')]);_0x5d483b[_0x39f7('0x29')]=qs[_0x39f7('0x29')](_0x13b69d[_0x39f7('0x37')][_0x39f7('0x29')]);}return _0x25cbf0[_0x39f7('0x55')](_0x5d483b);}})[_0x39f7('0x19')](function(_0x4c283c){if(_0x4c283c){return _0x4c283c?{'count':_0x3783c0,'rows':_0x4c283c}:null;}})[_0x39f7('0x19')](respondWithResult(_0x484653,null))[_0x39f7('0x24')](handleError(_0x484653,null));};exports[_0x39f7('0x58')]=function(_0x580b21,_0x1e1a81,_0x5c59ff){var _0x4a6a17={};var _0x978ac7={};var _0x517292;var _0x21f0cd;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x580b21[_0x39f7('0x4a')]['id']}})[_0x39f7('0x19')](handleEntityNotFound(_0x1e1a81,null))['then'](function(_0x5070b5){if(_0x5070b5){_0x517292=_0x5070b5;_0x978ac7[_0x39f7('0x3b')]=_[_0x39f7('0x38')](db[_0x39f7('0x56')][_0x39f7('0x34')]);_0x978ac7[_0x39f7('0x37')]=_['keys'](_0x580b21[_0x39f7('0x37')]);_0x978ac7['filters']=_[_0x39f7('0x3a')](_0x978ac7[_0x39f7('0x3b')],_0x978ac7[_0x39f7('0x37')]);_0x4a6a17[_0x39f7('0x3c')]=_[_0x39f7('0x3a')](_0x978ac7['model'],qs['fields'](_0x580b21[_0x39f7('0x37')][_0x39f7('0x3d')]));_0x4a6a17[_0x39f7('0x3c')]=_0x4a6a17['attributes'][_0x39f7('0x3e')]?_0x4a6a17[_0x39f7('0x3c')]:_0x978ac7[_0x39f7('0x3b')];_0x4a6a17[_0x39f7('0x57')]=qs[_0x39f7('0x40')](_0x580b21[_0x39f7('0x37')][_0x39f7('0x40')]);_0x4a6a17[_0x39f7('0x41')]=qs[_0x39f7('0x39')](_[_0x39f7('0x52')](_0x580b21['query'],_0x978ac7['filters']));if(_0x580b21[_0x39f7('0x37')][_0x39f7('0x44')]){_0x4a6a17['where']=_[_0x39f7('0x42')](_0x4a6a17['where'],{'$or':_[_0x39f7('0x32')](_0x4a6a17[_0x39f7('0x3c')],function(_0x54812d){var _0x487592={};_0x487592[_0x54812d]={'$like':'%'+_0x580b21[_0x39f7('0x37')][_0x39f7('0x44')]+'%'};return _0x487592;})});}_0x4a6a17=_[_0x39f7('0x42')]({},_0x4a6a17,_0x580b21[_0x39f7('0x4b')]);return _0x517292['getDescriptions'](_0x4a6a17);}})[_0x39f7('0x19')](function(_0x3998ef){if(_0x3998ef){_0x21f0cd=_0x3998ef['length'];if(!_0x580b21[_0x39f7('0x37')][_0x39f7('0x3f')](_0x39f7('0x53'))){_0x4a6a17[_0x39f7('0x2a')]=qs[_0x39f7('0x2a')](_0x580b21[_0x39f7('0x37')][_0x39f7('0x2a')]);_0x4a6a17[_0x39f7('0x29')]=qs['offset'](_0x580b21[_0x39f7('0x37')][_0x39f7('0x29')]);}return _0x517292[_0x39f7('0x58')](_0x4a6a17);}})[_0x39f7('0x19')](function(_0x4b2b22){if(_0x4b2b22){return _0x4b2b22?{'count':_0x21f0cd,'rows':_0x4b2b22}:null;}})[_0x39f7('0x19')](respondWithResult(_0x1e1a81,null))[_0x39f7('0x24')](handleError(_0x1e1a81,null));};
\ No newline at end of file
+var _0x3145=['findAll','rows','params','create','body','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include'];(function(_0xe5dd06,_0x3cd7b4){var _0x265fbe=function(_0x4a9ec4){while(--_0x4a9ec4){_0xe5dd06['push'](_0xe5dd06['shift']());}};_0x265fbe(++_0x3cd7b4);}(_0x3145,0xc7));var _0x5314=function(_0x1a7575,_0x74fab1){_0x1a7575=_0x1a7575-0x0;var _0x7a87d6=_0x3145[_0x1a7575];return _0x7a87d6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5314('0x0'));var rimraf=require(_0x5314('0x1'));var zipdir=require(_0x5314('0x2'));var jsonpatch=require(_0x5314('0x3'));var rp=require(_0x5314('0x4'));var moment=require(_0x5314('0x5'));var BPromise=require(_0x5314('0x6'));var Mustache=require(_0x5314('0x7'));var util=require('util');var path=require(_0x5314('0x8'));var sox=require('sox');var csv=require(_0x5314('0x9'));var ejs=require(_0x5314('0xa'));var fs=require('fs');var _=require(_0x5314('0xb'));var squel=require('squel');var crypto=require(_0x5314('0xc'));var jsforce=require(_0x5314('0xd'));var deskjs=require(_0x5314('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5314('0xf'));var Papa=require('papaparse');var Redis=require(_0x5314('0x10'));var authService=require(_0x5314('0x11'));var qs=require(_0x5314('0x12'));var as=require(_0x5314('0x13'));var hardwareService=require(_0x5314('0x14'));var logger=require(_0x5314('0x15'))(_0x5314('0x16'));var utils=require(_0x5314('0x17'));var config=require(_0x5314('0x18'));var licenseUtil=require(_0x5314('0x19'));var db=require(_0x5314('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5314('0x1b')][_0x5314('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x466e44,_0xe81396,_0xb16782,_0x515890){return new BPromise(function(_0x2278bc,_0x544d0a){var _0x454b91=_0x515890||client;return _0x454b91[_0x5314('0x1d')](_0x466e44,_0xb16782)[_0x5314('0x1e')](function(_0x2ba0ad){logger[_0x5314('0x1f')](_0x5314('0x20'),_0xe81396,_0x5314('0x21'));logger[_0x5314('0x22')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0xe81396,_0x5314('0x21'),JSON[_0x5314('0x23')](_0x2ba0ad));if(_0x2ba0ad[_0x5314('0x24')]){if(_0x2ba0ad['error'][_0x5314('0x25')]===0x1f4){logger[_0x5314('0x24')](_0x5314('0x20'),_0xe81396,_0x2ba0ad[_0x5314('0x24')][_0x5314('0x26')]);return _0x544d0a(_0x2ba0ad[_0x5314('0x24')]['message']);}logger['error'](_0x5314('0x20'),_0xe81396,_0x2ba0ad[_0x5314('0x24')][_0x5314('0x26')]);return _0x2278bc(_0x2ba0ad[_0x5314('0x24')][_0x5314('0x26')]);}else{logger['info'](_0x5314('0x20'),_0xe81396,'request\x20sent');_0x2278bc(_0x2ba0ad[_0x5314('0x27')][_0x5314('0x26')]);}})[_0x5314('0x28')](function(_0x2d743e){logger[_0x5314('0x24')](_0x5314('0x20'),_0xe81396,_0x2d743e);_0x544d0a(_0x2d743e);});});}function respondWithStatusCode(_0x2dcefe,_0x4e974b){_0x4e974b=_0x4e974b||0xcc;return function(_0x1e4777){if(_0x1e4777){return _0x2dcefe[_0x5314('0x29')](_0x4e974b);}return _0x2dcefe['status'](_0x4e974b)[_0x5314('0x2a')]();};}function respondWithResult(_0x809d44,_0x2091a3){_0x2091a3=_0x2091a3||0xc8;return function(_0x19f9b6){if(_0x19f9b6){return _0x809d44[_0x5314('0x2b')](_0x2091a3)[_0x5314('0x2c')](_0x19f9b6);}};}function respondWithFilteredResult(_0x492f67,_0x247de3){return function(_0x54b613){if(_0x54b613){var _0x284233=_0x54b613[_0x5314('0x2d')],_0x255789=_0x247de3[_0x5314('0x2e')],_0xa5110=_0x247de3['offset']+_0x247de3[_0x5314('0x2f')],_0x559365;if(_0xa5110>=_0x284233){_0xa5110=_0x284233;_0x559365=0xc8;}else{_0x559365=0xce;}_0x492f67['status'](_0x559365);return _0x492f67[_0x5314('0x30')](_0x5314('0x31'),_0x255789+'-'+_0xa5110+'/'+_0x284233)[_0x5314('0x2c')](_0x54b613);}return null;};}function patchUpdates(_0x229146){return function(_0x3f771d){try{jsonpatch['apply'](_0x3f771d,_0x229146,!![]);}catch(_0x40a2ca){return BPromise[_0x5314('0x32')](_0x40a2ca);}return _0x3f771d[_0x5314('0x33')]();};}function saveUpdates(_0x2a4e6d,_0x53e954){return function(_0xfa73d6){if(_0xfa73d6){return _0xfa73d6['update'](_0x2a4e6d)['then'](function(_0x16c887){return _0x16c887;});}return null;};}function removeEntity(_0x55551f,_0x55367f){return function(_0x5aa9a2){if(_0x5aa9a2){return _0x5aa9a2[_0x5314('0x34')]()[_0x5314('0x1e')](function(){_0x55551f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712f8,_0x16929b){return function(_0x32d8b7){if(!_0x32d8b7){_0x3712f8[_0x5314('0x29')](0x194);}return _0x32d8b7;};}function handleError(_0x2dbeb7,_0x2ef047){_0x2ef047=_0x2ef047||0x1f4;return function(_0x232bf6){logger[_0x5314('0x24')](_0x232bf6[_0x5314('0x35')]);if(_0x232bf6[_0x5314('0x36')]){delete _0x232bf6['name'];}_0x2dbeb7[_0x5314('0x2b')](_0x2ef047)[_0x5314('0x37')](_0x232bf6);};}exports[_0x5314('0x38')]=function(_0x46bbf2,_0x2d3f01){var _0x3fca6d={},_0x1597dc={},_0x4952f2={'count':0x0,'rows':[]};var _0x1f7f20=_[_0x5314('0x39')](db['Dynamics365Configuration'][_0x5314('0x3a')],function(_0x1f8b99){return{'name':_0x1f8b99[_0x5314('0x3b')],'type':_0x1f8b99[_0x5314('0x3c')][_0x5314('0x3d')]};});_0x1597dc['model']=_['map'](_0x1f7f20,'name');_0x1597dc['query']=_[_0x5314('0x3e')](_0x46bbf2['query']);_0x1597dc[_0x5314('0x3f')]=_[_0x5314('0x40')](_0x1597dc[_0x5314('0x41')],_0x1597dc['query']);_0x3fca6d[_0x5314('0x42')]=_[_0x5314('0x40')](_0x1597dc[_0x5314('0x41')],qs[_0x5314('0x43')](_0x46bbf2[_0x5314('0x44')][_0x5314('0x43')]));_0x3fca6d[_0x5314('0x42')]=_0x3fca6d[_0x5314('0x42')][_0x5314('0x45')]?_0x3fca6d[_0x5314('0x42')]:_0x1597dc['model'];if(!_0x46bbf2[_0x5314('0x44')][_0x5314('0x46')](_0x5314('0x47'))){_0x3fca6d[_0x5314('0x2f')]=qs['limit'](_0x46bbf2[_0x5314('0x44')]['limit']);_0x3fca6d['offset']=qs[_0x5314('0x2e')](_0x46bbf2[_0x5314('0x44')][_0x5314('0x2e')]);}_0x3fca6d[_0x5314('0x48')]=qs['sort'](_0x46bbf2[_0x5314('0x44')][_0x5314('0x49')]);_0x3fca6d[_0x5314('0x4a')]=qs[_0x5314('0x3f')](_[_0x5314('0x4b')](_0x46bbf2[_0x5314('0x44')],_0x1597dc[_0x5314('0x3f')]),_0x1f7f20);if(_0x46bbf2['query'][_0x5314('0x4c')]){_0x3fca6d[_0x5314('0x4a')]=_[_0x5314('0x4d')](_0x3fca6d[_0x5314('0x4a')],{'$or':_[_0x5314('0x39')](_0x1f7f20,function(_0x226bb4){if(_0x226bb4[_0x5314('0x3c')]!==_0x5314('0x4e')){var _0xbecde6={};_0xbecde6[_0x226bb4[_0x5314('0x36')]]={'$like':'%'+_0x46bbf2[_0x5314('0x44')][_0x5314('0x4c')]+'%'};return _0xbecde6;}})});}_0x3fca6d=_[_0x5314('0x4d')]({},_0x3fca6d,_0x46bbf2[_0x5314('0x4f')]);var _0x3f5bb4={'where':_0x3fca6d[_0x5314('0x4a')]};return db[_0x5314('0x50')][_0x5314('0x2d')](_0x3f5bb4)['then'](function(_0x3119df){_0x4952f2[_0x5314('0x2d')]=_0x3119df;if(_0x46bbf2[_0x5314('0x44')][_0x5314('0x51')]){_0x3fca6d[_0x5314('0x52')]=[{'all':!![]}];}return db[_0x5314('0x50')][_0x5314('0x53')](_0x3fca6d);})['then'](function(_0x458f46){_0x4952f2[_0x5314('0x54')]=_0x458f46;return _0x4952f2;})[_0x5314('0x1e')](respondWithFilteredResult(_0x2d3f01,_0x3fca6d))[_0x5314('0x28')](handleError(_0x2d3f01,null));};exports['show']=function(_0x1e53ba,_0x469ef3){var _0x1f93b0={'raw':![],'where':{'id':_0x1e53ba[_0x5314('0x55')]['id']}},_0x276726={};_0x276726['model']=_[_0x5314('0x3e')](db[_0x5314('0x50')][_0x5314('0x3a')]);_0x276726[_0x5314('0x44')]=_['keys'](_0x1e53ba[_0x5314('0x44')]);_0x276726[_0x5314('0x3f')]=_['intersection'](_0x276726[_0x5314('0x41')],_0x276726['query']);_0x1f93b0[_0x5314('0x42')]=_[_0x5314('0x40')](_0x276726[_0x5314('0x41')],qs[_0x5314('0x43')](_0x1e53ba[_0x5314('0x44')][_0x5314('0x43')]));_0x1f93b0[_0x5314('0x42')]=_0x1f93b0[_0x5314('0x42')][_0x5314('0x45')]?_0x1f93b0[_0x5314('0x42')]:_0x276726[_0x5314('0x41')];if(_0x1e53ba[_0x5314('0x44')][_0x5314('0x51')]){_0x1f93b0[_0x5314('0x52')]=[{'all':!![]}];}_0x1f93b0=_[_0x5314('0x4d')]({},_0x1f93b0,_0x1e53ba[_0x5314('0x4f')]);return db[_0x5314('0x50')]['find'](_0x1f93b0)[_0x5314('0x1e')](handleEntityNotFound(_0x469ef3,null))[_0x5314('0x1e')](respondWithResult(_0x469ef3,null))['catch'](handleError(_0x469ef3,null));};exports[_0x5314('0x56')]=function(_0x805b18,_0x397a36){return db['Dynamics365Configuration'][_0x5314('0x56')](_0x805b18[_0x5314('0x57')],{})[_0x5314('0x1e')](respondWithResult(_0x397a36,0xc9))[_0x5314('0x28')](handleError(_0x397a36,null));};exports['update']=function(_0x1c3407,_0x46e471){if(_0x1c3407[_0x5314('0x57')]['id']){delete _0x1c3407[_0x5314('0x57')]['id'];}return db[_0x5314('0x50')][_0x5314('0x58')]({'where':{'id':_0x1c3407['params']['id']}})['then'](handleEntityNotFound(_0x46e471,null))[_0x5314('0x1e')](saveUpdates(_0x1c3407[_0x5314('0x57')],null))['then'](respondWithResult(_0x46e471,null))['catch'](handleError(_0x46e471,null));};exports[_0x5314('0x34')]=function(_0x551610,_0x173005){return db[_0x5314('0x50')]['find']({'where':{'id':_0x551610[_0x5314('0x55')]['id']}})['then'](handleEntityNotFound(_0x173005,null))['then'](removeEntity(_0x173005,null))[_0x5314('0x28')](handleError(_0x173005,null));};exports[_0x5314('0x59')]=function(_0x1fddbb,_0x32e933,_0x367512){var _0x3714a0={};var _0x46ae24={};var _0x402d97;var _0x118e39;return db['Dynamics365Configuration'][_0x5314('0x5a')]({'where':{'id':_0x1fddbb[_0x5314('0x55')]['id']}})['then'](handleEntityNotFound(_0x32e933,null))[_0x5314('0x1e')](function(_0x3e6d6f){if(_0x3e6d6f){_0x402d97=_0x3e6d6f;_0x46ae24['model']=_[_0x5314('0x3e')](db['Dynamics365Field'][_0x5314('0x3a')]);_0x46ae24[_0x5314('0x44')]=_[_0x5314('0x3e')](_0x1fddbb[_0x5314('0x44')]);_0x46ae24[_0x5314('0x3f')]=_[_0x5314('0x40')](_0x46ae24['model'],_0x46ae24[_0x5314('0x44')]);_0x3714a0[_0x5314('0x42')]=_[_0x5314('0x40')](_0x46ae24['model'],qs[_0x5314('0x43')](_0x1fddbb[_0x5314('0x44')][_0x5314('0x43')]));_0x3714a0[_0x5314('0x42')]=_0x3714a0['attributes'][_0x5314('0x45')]?_0x3714a0[_0x5314('0x42')]:_0x46ae24[_0x5314('0x41')];_0x3714a0[_0x5314('0x48')]=qs[_0x5314('0x49')](_0x1fddbb['query']['sort']);_0x3714a0[_0x5314('0x4a')]=qs[_0x5314('0x3f')](_[_0x5314('0x4b')](_0x1fddbb['query'],_0x46ae24[_0x5314('0x3f')]));if(_0x1fddbb['query']['filter']){_0x3714a0['where']=_[_0x5314('0x4d')](_0x3714a0[_0x5314('0x4a')],{'$or':_[_0x5314('0x39')](_0x3714a0[_0x5314('0x42')],function(_0x896b15){var _0x2d0398={};_0x2d0398[_0x896b15]={'$like':'%'+_0x1fddbb[_0x5314('0x44')]['filter']+'%'};return _0x2d0398;})});}_0x3714a0=_['merge']({},_0x3714a0,_0x1fddbb['options']);return _0x402d97[_0x5314('0x59')](_0x3714a0);}})['then'](function(_0x2707fd){if(_0x2707fd){_0x118e39=_0x2707fd[_0x5314('0x45')];if(!_0x1fddbb['query'][_0x5314('0x46')](_0x5314('0x47'))){_0x3714a0['limit']=qs[_0x5314('0x2f')](_0x1fddbb['query'][_0x5314('0x2f')]);_0x3714a0[_0x5314('0x2e')]=qs['offset'](_0x1fddbb['query']['offset']);}return _0x402d97[_0x5314('0x59')](_0x3714a0);}})[_0x5314('0x1e')](function(_0xb69166){if(_0xb69166){return _0xb69166?{'count':_0x118e39,'rows':_0xb69166}:null;}})[_0x5314('0x1e')](respondWithResult(_0x32e933,null))[_0x5314('0x28')](handleError(_0x32e933,null));};exports['getSubjects']=function(_0x9bba43,_0x258ff9,_0x3ed275){var _0x490d17={};var _0x837a8f={};var _0x3b3fe8;var _0x59c21b;return db['Dynamics365Configuration'][_0x5314('0x5a')]({'where':{'id':_0x9bba43[_0x5314('0x55')]['id']}})[_0x5314('0x1e')](handleEntityNotFound(_0x258ff9,null))[_0x5314('0x1e')](function(_0x27fb2c){if(_0x27fb2c){_0x3b3fe8=_0x27fb2c;_0x837a8f[_0x5314('0x41')]=_[_0x5314('0x3e')](db[_0x5314('0x5b')][_0x5314('0x3a')]);_0x837a8f[_0x5314('0x44')]=_[_0x5314('0x3e')](_0x9bba43[_0x5314('0x44')]);_0x837a8f['filters']=_['intersection'](_0x837a8f[_0x5314('0x41')],_0x837a8f[_0x5314('0x44')]);_0x490d17[_0x5314('0x42')]=_[_0x5314('0x40')](_0x837a8f[_0x5314('0x41')],qs[_0x5314('0x43')](_0x9bba43[_0x5314('0x44')][_0x5314('0x43')]));_0x490d17['attributes']=_0x490d17[_0x5314('0x42')][_0x5314('0x45')]?_0x490d17[_0x5314('0x42')]:_0x837a8f[_0x5314('0x41')];_0x490d17[_0x5314('0x48')]=qs[_0x5314('0x49')](_0x9bba43[_0x5314('0x44')]['sort']);_0x490d17['where']=qs[_0x5314('0x3f')](_[_0x5314('0x4b')](_0x9bba43[_0x5314('0x44')],_0x837a8f['filters']));if(_0x9bba43[_0x5314('0x44')][_0x5314('0x4c')]){_0x490d17[_0x5314('0x4a')]=_[_0x5314('0x4d')](_0x490d17['where'],{'$or':_['map'](_0x490d17[_0x5314('0x42')],function(_0x3df434){var _0x2c4216={};_0x2c4216[_0x3df434]={'$like':'%'+_0x9bba43['query'][_0x5314('0x4c')]+'%'};return _0x2c4216;})});}_0x490d17=_[_0x5314('0x4d')]({},_0x490d17,_0x9bba43[_0x5314('0x4f')]);return _0x3b3fe8[_0x5314('0x5c')](_0x490d17);}})[_0x5314('0x1e')](function(_0x292e42){if(_0x292e42){_0x59c21b=_0x292e42['length'];if(!_0x9bba43[_0x5314('0x44')]['hasOwnProperty'](_0x5314('0x47'))){_0x490d17[_0x5314('0x2f')]=qs['limit'](_0x9bba43[_0x5314('0x44')][_0x5314('0x2f')]);_0x490d17[_0x5314('0x2e')]=qs[_0x5314('0x2e')](_0x9bba43['query'][_0x5314('0x2e')]);}return _0x3b3fe8[_0x5314('0x5c')](_0x490d17);}})[_0x5314('0x1e')](function(_0x314f13){if(_0x314f13){return _0x314f13?{'count':_0x59c21b,'rows':_0x314f13}:null;}})[_0x5314('0x1e')](respondWithResult(_0x258ff9,null))[_0x5314('0x28')](handleError(_0x258ff9,null));};exports[_0x5314('0x5d')]=function(_0xcd262b,_0x529b06,_0x41f9b9){var _0x5de59e={};var _0x2bb0dc={};var _0x1e4ba5;var _0x458350;return db['Dynamics365Configuration'][_0x5314('0x5a')]({'where':{'id':_0xcd262b[_0x5314('0x55')]['id']}})[_0x5314('0x1e')](handleEntityNotFound(_0x529b06,null))[_0x5314('0x1e')](function(_0x169d40){if(_0x169d40){_0x1e4ba5=_0x169d40;_0x2bb0dc['model']=_[_0x5314('0x3e')](db[_0x5314('0x5b')][_0x5314('0x3a')]);_0x2bb0dc[_0x5314('0x44')]=_['keys'](_0xcd262b['query']);_0x2bb0dc[_0x5314('0x3f')]=_['intersection'](_0x2bb0dc[_0x5314('0x41')],_0x2bb0dc[_0x5314('0x44')]);_0x5de59e['attributes']=_[_0x5314('0x40')](_0x2bb0dc[_0x5314('0x41')],qs[_0x5314('0x43')](_0xcd262b[_0x5314('0x44')][_0x5314('0x43')]));_0x5de59e[_0x5314('0x42')]=_0x5de59e[_0x5314('0x42')][_0x5314('0x45')]?_0x5de59e[_0x5314('0x42')]:_0x2bb0dc[_0x5314('0x41')];_0x5de59e[_0x5314('0x48')]=qs[_0x5314('0x49')](_0xcd262b['query'][_0x5314('0x49')]);_0x5de59e[_0x5314('0x4a')]=qs[_0x5314('0x3f')](_['pick'](_0xcd262b[_0x5314('0x44')],_0x2bb0dc[_0x5314('0x3f')]));if(_0xcd262b[_0x5314('0x44')][_0x5314('0x4c')]){_0x5de59e[_0x5314('0x4a')]=_[_0x5314('0x4d')](_0x5de59e[_0x5314('0x4a')],{'$or':_[_0x5314('0x39')](_0x5de59e['attributes'],function(_0x331555){var _0x1769df={};_0x1769df[_0x331555]={'$like':'%'+_0xcd262b[_0x5314('0x44')]['filter']+'%'};return _0x1769df;})});}_0x5de59e=_['merge']({},_0x5de59e,_0xcd262b['options']);return _0x1e4ba5[_0x5314('0x5d')](_0x5de59e);}})[_0x5314('0x1e')](function(_0x12db46){if(_0x12db46){_0x458350=_0x12db46[_0x5314('0x45')];if(!_0xcd262b[_0x5314('0x44')]['hasOwnProperty'](_0x5314('0x47'))){_0x5de59e[_0x5314('0x2f')]=qs[_0x5314('0x2f')](_0xcd262b['query'][_0x5314('0x2f')]);_0x5de59e[_0x5314('0x2e')]=qs['offset'](_0xcd262b['query'][_0x5314('0x2e')]);}return _0x1e4ba5[_0x5314('0x5d')](_0x5de59e);}})[_0x5314('0x1e')](function(_0x4f188c){if(_0x4f188c){return _0x4f188c?{'count':_0x458350,'rows':_0x4f188c}:null;}})['then'](respondWithResult(_0x529b06,null))[_0x5314('0x28')](handleError(_0x529b06,null));};
\ No newline at end of file