Built motion from commit (unavailable).|2.3.7
[motion2.git] / server / api / intDynamics365Configuration / intDynamics365Configuration.controller.js
index b1bf1b5..b903a5c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfcbb=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','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','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','index','Dynamics365Configuration','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','map','key','VIRTUAL','count','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','findOne','merge','options','nolimit','getFields','getSubjects','params','Dynamics365Field','getDescriptions','html-pdf','eml-format','rimraf','request-promise'];(function(_0x2c1709,_0x3d48f9){var _0x4232c9=function(_0x3f6be7){while(--_0x3f6be7){_0x2c1709['push'](_0x2c1709['shift']());}};_0x4232c9(++_0x3d48f9);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x3250ac,_0x43a5e0){_0x3250ac=_0x3250ac-0x0;var _0x1a0a43=_0xfcbb[_0x3250ac];return _0x1a0a43;};'use strict';var pdf=require(_0xbfcb('0x0'));var emlformat=require(_0xbfcb('0x1'));var rimraf=require(_0xbfcb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbfcb('0x3'));var moment=require(_0xbfcb('0x4'));var BPromise=require(_0xbfcb('0x5'));var Mustache=require(_0xbfcb('0x6'));var util=require(_0xbfcb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbfcb('0x8'));var ejs=require(_0xbfcb('0x9'));var fs=require('fs');var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var authService=require(_0xbfcb('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xbfcb('0x12'));var qs=require(_0xbfcb('0x13'));var logger=require(_0xbfcb('0x14'))(_0xbfcb('0x15'));var utils=require(_0xbfcb('0x16'));var config=require(_0xbfcb('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbfcb('0x18'));var client=jayson[_0xbfcb('0x19')][_0xbfcb('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2268da,_0x4ba4f1,_0x3dc54a,_0x53eeaf){return new BPromise(function(_0x211a30,_0x1c52df){var _0x44ad6c=_0x53eeaf||client;return _0x44ad6c[_0xbfcb('0x1b')](_0x2268da,_0x3dc54a)[_0xbfcb('0x1c')](function(_0xe47707){logger[_0xbfcb('0x1d')](_0xbfcb('0x1e'),_0x4ba4f1,_0xbfcb('0x1f'));logger[_0xbfcb('0x20')](_0xbfcb('0x21'),_0x4ba4f1,_0xbfcb('0x1f'),JSON[_0xbfcb('0x22')](_0xe47707));if(_0xe47707[_0xbfcb('0x23')]){if(_0xe47707[_0xbfcb('0x23')][_0xbfcb('0x24')]===0x1f4){logger[_0xbfcb('0x23')](_0xbfcb('0x1e'),_0x4ba4f1,_0xe47707[_0xbfcb('0x23')][_0xbfcb('0x25')]);return _0x1c52df(_0xe47707[_0xbfcb('0x23')][_0xbfcb('0x25')]);}logger['error'](_0xbfcb('0x1e'),_0x4ba4f1,_0xe47707[_0xbfcb('0x23')]['message']);return _0x211a30(_0xe47707[_0xbfcb('0x23')][_0xbfcb('0x25')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x4ba4f1,_0xbfcb('0x1f'));_0x211a30(_0xe47707[_0xbfcb('0x26')][_0xbfcb('0x25')]);}})[_0xbfcb('0x27')](function(_0x1c5924){logger['error'](_0xbfcb('0x1e'),_0x4ba4f1,_0x1c5924);_0x1c52df(_0x1c5924);});});}function respondWithStatusCode(_0x423bba,_0x2d9288){_0x2d9288=_0x2d9288||0xcc;return function(_0xd4d29){if(_0xd4d29){return _0x423bba[_0xbfcb('0x28')](_0x2d9288);}return _0x423bba[_0xbfcb('0x29')](_0x2d9288)[_0xbfcb('0x2a')]();};}function respondWithResult(_0x14e43c,_0x11f6f7){_0x11f6f7=_0x11f6f7||0xc8;return function(_0x13e101){if(_0x13e101){return _0x14e43c[_0xbfcb('0x29')](_0x11f6f7)[_0xbfcb('0x2b')](_0x13e101);}};}function respondWithFilteredResult(_0x3ef71c,_0x121a90){return function(_0x3e954d){if(_0x3e954d){var _0x2a1272=_0x3e954d['count'],_0x5cd703=_0x121a90[_0xbfcb('0x2c')],_0x3465f5=_0x121a90[_0xbfcb('0x2c')]+_0x121a90[_0xbfcb('0x2d')],_0x2881f8;if(_0x3465f5>=_0x2a1272){_0x3465f5=_0x2a1272;_0x2881f8=0xc8;}else{_0x2881f8=0xce;}_0x3ef71c[_0xbfcb('0x29')](_0x2881f8);return _0x3ef71c[_0xbfcb('0x2e')](_0xbfcb('0x2f'),_0x5cd703+'-'+_0x3465f5+'/'+_0x2a1272)[_0xbfcb('0x2b')](_0x3e954d);}return null;};}function patchUpdates(_0x1a5db2){return function(_0x434764){try{jsonpatch[_0xbfcb('0x30')](_0x434764,_0x1a5db2,!![]);}catch(_0x59719b){return BPromise[_0xbfcb('0x31')](_0x59719b);}return _0x434764[_0xbfcb('0x32')]();};}function saveUpdates(_0x43c3c3,_0x43de3c){return function(_0x1f45fc){if(_0x1f45fc){return _0x1f45fc[_0xbfcb('0x33')](_0x43c3c3)[_0xbfcb('0x1c')](function(_0x797513){return _0x797513;});}return null;};}function removeEntity(_0x3fafe8,_0x5be764){return function(_0x297f72){if(_0x297f72){return _0x297f72[_0xbfcb('0x34')]()[_0xbfcb('0x1c')](function(){_0x3fafe8[_0xbfcb('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa2dd,_0x30cf97){return function(_0x35925b){if(!_0x35925b){_0x5aa2dd[_0xbfcb('0x28')](0x194);}return _0x35925b;};}function handleError(_0x1b2fa5,_0x32d9a2){_0x32d9a2=_0x32d9a2||0x1f4;return function(_0x24f2a6){logger[_0xbfcb('0x23')](_0x24f2a6['stack']);if(_0x24f2a6['name']){delete _0x24f2a6['name'];}_0x1b2fa5[_0xbfcb('0x29')](_0x32d9a2)['send'](_0x24f2a6);};}exports[_0xbfcb('0x35')]=function(_0x410948,_0x505b0d){var _0x49c295={},_0x935af={},_0x256177={'count':0x0,'rows':[]};var _0x12deab=db[_0xbfcb('0x36')]['rawAttributes'];_0x935af[_0xbfcb('0x37')]=_[_0xbfcb('0x38')](_0x12deab);_0x935af['query']=_['keys'](_0x410948[_0xbfcb('0x39')]);_0x935af['filters']=_['intersection'](_0x935af[_0xbfcb('0x37')],_0x935af[_0xbfcb('0x39')]);_0x49c295[_0xbfcb('0x3a')]=_[_0xbfcb('0x3b')](_0x935af['model'],qs[_0xbfcb('0x3c')](_0x410948[_0xbfcb('0x39')][_0xbfcb('0x3c')]));_0x49c295[_0xbfcb('0x3a')]=_0x49c295[_0xbfcb('0x3a')][_0xbfcb('0x3d')]?_0x49c295['attributes']:_0x935af[_0xbfcb('0x37')];if(!_0x410948['query'][_0xbfcb('0x3e')]('nolimit')){_0x49c295[_0xbfcb('0x2d')]=qs[_0xbfcb('0x2d')](_0x410948[_0xbfcb('0x39')][_0xbfcb('0x2d')]);_0x49c295[_0xbfcb('0x2c')]=qs[_0xbfcb('0x2c')](_0x410948[_0xbfcb('0x39')][_0xbfcb('0x2c')]);}_0x49c295[_0xbfcb('0x3f')]=qs[_0xbfcb('0x40')](_0x410948['query'][_0xbfcb('0x40')]);_0x49c295[_0xbfcb('0x41')]=qs['filters'](_[_0xbfcb('0x42')](_0x410948[_0xbfcb('0x39')],_0x935af[_0xbfcb('0x43')]));if(_0x410948[_0xbfcb('0x39')][_0xbfcb('0x44')]){_0x49c295[_0xbfcb('0x41')]=_['merge'](_0x49c295[_0xbfcb('0x41')],{'$or':_[_0xbfcb('0x45')](_0x12deab,function(_0x10ea4f){if(_0x10ea4f['type'][_0xbfcb('0x46')]!==_0xbfcb('0x47')){var _0xa37d7f={};_0xa37d7f[_0x10ea4f['field']]={'$like':'%'+_0x410948[_0xbfcb('0x39')][_0xbfcb('0x44')]+'%'};return _0xa37d7f;}})});}_0x49c295=_['merge']({},_0x49c295,_0x410948['options']);var _0x3726dc={'where':_0x49c295[_0xbfcb('0x41')]};return db['Dynamics365Configuration'][_0xbfcb('0x48')](_0x3726dc)[_0xbfcb('0x1c')](function(_0x58cfa2){_0x256177[_0xbfcb('0x48')]=_0x58cfa2;if(_0x410948[_0xbfcb('0x39')][_0xbfcb('0x49')]){_0x49c295[_0xbfcb('0x4a')]=[{'all':!![]}];}return db[_0xbfcb('0x36')][_0xbfcb('0x4b')](_0x49c295);})[_0xbfcb('0x1c')](function(_0x227e67){_0x256177[_0xbfcb('0x4c')]=_0x227e67;return _0x256177;})[_0xbfcb('0x1c')](respondWithFilteredResult(_0x505b0d,_0x49c295))[_0xbfcb('0x27')](handleError(_0x505b0d,null));};exports[_0xbfcb('0x4d')]=function(_0x5f307b,_0x12889b){var _0x3f7282={'raw':![],'where':{'id':_0x5f307b['params']['id']}},_0x124293={};_0x124293[_0xbfcb('0x37')]=_['keys'](db['Dynamics365Configuration'][_0xbfcb('0x4e')]);_0x124293[_0xbfcb('0x39')]=_[_0xbfcb('0x38')](_0x5f307b['query']);_0x124293[_0xbfcb('0x43')]=_['intersection'](_0x124293['model'],_0x124293[_0xbfcb('0x39')]);_0x3f7282['attributes']=_[_0xbfcb('0x3b')](_0x124293[_0xbfcb('0x37')],qs['fields'](_0x5f307b[_0xbfcb('0x39')]['fields']));_0x3f7282[_0xbfcb('0x3a')]=_0x3f7282['attributes'][_0xbfcb('0x3d')]?_0x3f7282['attributes']:_0x124293[_0xbfcb('0x37')];if(_0x5f307b[_0xbfcb('0x39')]['includeAll']){_0x3f7282[_0xbfcb('0x4a')]=[{'all':!![]}];}_0x3f7282=_['merge']({},_0x3f7282,_0x5f307b['options']);return db[_0xbfcb('0x36')][_0xbfcb('0x4f')](_0x3f7282)[_0xbfcb('0x1c')](handleEntityNotFound(_0x12889b,null))['then'](respondWithResult(_0x12889b,null))['catch'](handleError(_0x12889b,null));};exports[_0xbfcb('0x50')]=function(_0x931bf,_0x294e9e){return db[_0xbfcb('0x36')][_0xbfcb('0x50')](_0x931bf['body'],{})[_0xbfcb('0x1c')](respondWithResult(_0x294e9e,0xc9))[_0xbfcb('0x27')](handleError(_0x294e9e,null));};exports[_0xbfcb('0x33')]=function(_0x225c45,_0x4d1264){if(_0x225c45['body']['id']){delete _0x225c45[_0xbfcb('0x51')]['id'];}return db['Dynamics365Configuration'][_0xbfcb('0x4f')]({'where':{'id':_0x225c45['params']['id']}})['then'](handleEntityNotFound(_0x4d1264,null))[_0xbfcb('0x1c')](saveUpdates(_0x225c45['body'],null))['then'](respondWithResult(_0x4d1264,null))[_0xbfcb('0x27')](handleError(_0x4d1264,null));};exports['destroy']=function(_0x216a2a,_0x533b69){return db[_0xbfcb('0x36')][_0xbfcb('0x4f')]({'where':{'id':_0x216a2a['params']['id']}})[_0xbfcb('0x1c')](handleEntityNotFound(_0x533b69,null))[_0xbfcb('0x1c')](removeEntity(_0x533b69,null))[_0xbfcb('0x27')](handleError(_0x533b69,null));};exports['getFields']=function(_0x3cd568,_0xc44640,_0x2534fe){var _0x4311d9={};var _0x51a06e={};var _0x4421fc;var _0x338222;return db['Dynamics365Configuration'][_0xbfcb('0x52')]({'where':{'id':_0x3cd568['params']['id']}})[_0xbfcb('0x1c')](handleEntityNotFound(_0xc44640,null))[_0xbfcb('0x1c')](function(_0x2e840e){if(_0x2e840e){_0x4421fc=_0x2e840e;_0x51a06e[_0xbfcb('0x37')]=_['keys'](db['Dynamics365Field'][_0xbfcb('0x4e')]);_0x51a06e['query']=_[_0xbfcb('0x38')](_0x3cd568[_0xbfcb('0x39')]);_0x51a06e[_0xbfcb('0x43')]=_[_0xbfcb('0x3b')](_0x51a06e[_0xbfcb('0x37')],_0x51a06e[_0xbfcb('0x39')]);_0x4311d9['attributes']=_[_0xbfcb('0x3b')](_0x51a06e[_0xbfcb('0x37')],qs[_0xbfcb('0x3c')](_0x3cd568[_0xbfcb('0x39')][_0xbfcb('0x3c')]));_0x4311d9[_0xbfcb('0x3a')]=_0x4311d9[_0xbfcb('0x3a')]['length']?_0x4311d9['attributes']:_0x51a06e['model'];_0x4311d9[_0xbfcb('0x3f')]=qs[_0xbfcb('0x40')](_0x3cd568[_0xbfcb('0x39')]['sort']);_0x4311d9[_0xbfcb('0x41')]=qs[_0xbfcb('0x43')](_[_0xbfcb('0x42')](_0x3cd568['query'],_0x51a06e['filters']));if(_0x3cd568['query'][_0xbfcb('0x44')]){_0x4311d9[_0xbfcb('0x41')]=_[_0xbfcb('0x53')](_0x4311d9[_0xbfcb('0x41')],{'$or':_['map'](_0x4311d9[_0xbfcb('0x3a')],function(_0x1e5199){var _0x39a3cf={};_0x39a3cf[_0x1e5199]={'$like':'%'+_0x3cd568['query']['filter']+'%'};return _0x39a3cf;})});}_0x4311d9=_[_0xbfcb('0x53')]({},_0x4311d9,_0x3cd568[_0xbfcb('0x54')]);return _0x4421fc['getFields'](_0x4311d9);}})['then'](function(_0x4866ef){if(_0x4866ef){_0x338222=_0x4866ef['length'];if(!_0x3cd568[_0xbfcb('0x39')][_0xbfcb('0x3e')](_0xbfcb('0x55'))){_0x4311d9[_0xbfcb('0x2d')]=qs[_0xbfcb('0x2d')](_0x3cd568[_0xbfcb('0x39')][_0xbfcb('0x2d')]);_0x4311d9[_0xbfcb('0x2c')]=qs['offset'](_0x3cd568[_0xbfcb('0x39')][_0xbfcb('0x2c')]);}return _0x4421fc[_0xbfcb('0x56')](_0x4311d9);}})[_0xbfcb('0x1c')](function(_0x18d909){if(_0x18d909){return _0x18d909?{'count':_0x338222,'rows':_0x18d909}:null;}})[_0xbfcb('0x1c')](respondWithResult(_0xc44640,null))[_0xbfcb('0x27')](handleError(_0xc44640,null));};exports[_0xbfcb('0x57')]=function(_0x582b60,_0xe35368,_0x49a08f){var _0x14a28d={};var _0x2a1368={};var _0x279fd9;var _0x2f0934;return db[_0xbfcb('0x36')]['findOne']({'where':{'id':_0x582b60[_0xbfcb('0x58')]['id']}})[_0xbfcb('0x1c')](handleEntityNotFound(_0xe35368,null))[_0xbfcb('0x1c')](function(_0x1bca83){if(_0x1bca83){_0x279fd9=_0x1bca83;_0x2a1368[_0xbfcb('0x37')]=_['keys'](db[_0xbfcb('0x59')][_0xbfcb('0x4e')]);_0x2a1368[_0xbfcb('0x39')]=_[_0xbfcb('0x38')](_0x582b60['query']);_0x2a1368['filters']=_[_0xbfcb('0x3b')](_0x2a1368[_0xbfcb('0x37')],_0x2a1368[_0xbfcb('0x39')]);_0x14a28d[_0xbfcb('0x3a')]=_[_0xbfcb('0x3b')](_0x2a1368[_0xbfcb('0x37')],qs[_0xbfcb('0x3c')](_0x582b60[_0xbfcb('0x39')][_0xbfcb('0x3c')]));_0x14a28d[_0xbfcb('0x3a')]=_0x14a28d[_0xbfcb('0x3a')][_0xbfcb('0x3d')]?_0x14a28d[_0xbfcb('0x3a')]:_0x2a1368[_0xbfcb('0x37')];_0x14a28d['order']=qs[_0xbfcb('0x40')](_0x582b60['query'][_0xbfcb('0x40')]);_0x14a28d[_0xbfcb('0x41')]=qs['filters'](_[_0xbfcb('0x42')](_0x582b60[_0xbfcb('0x39')],_0x2a1368[_0xbfcb('0x43')]));if(_0x582b60[_0xbfcb('0x39')]['filter']){_0x14a28d[_0xbfcb('0x41')]=_['merge'](_0x14a28d[_0xbfcb('0x41')],{'$or':_[_0xbfcb('0x45')](_0x14a28d['attributes'],function(_0x5db930){var _0x4530ee={};_0x4530ee[_0x5db930]={'$like':'%'+_0x582b60[_0xbfcb('0x39')][_0xbfcb('0x44')]+'%'};return _0x4530ee;})});}_0x14a28d=_[_0xbfcb('0x53')]({},_0x14a28d,_0x582b60[_0xbfcb('0x54')]);return _0x279fd9['getSubjects'](_0x14a28d);}})['then'](function(_0x3b9cfe){if(_0x3b9cfe){_0x2f0934=_0x3b9cfe['length'];if(!_0x582b60['query'][_0xbfcb('0x3e')](_0xbfcb('0x55'))){_0x14a28d['limit']=qs[_0xbfcb('0x2d')](_0x582b60[_0xbfcb('0x39')]['limit']);_0x14a28d[_0xbfcb('0x2c')]=qs[_0xbfcb('0x2c')](_0x582b60[_0xbfcb('0x39')][_0xbfcb('0x2c')]);}return _0x279fd9['getSubjects'](_0x14a28d);}})[_0xbfcb('0x1c')](function(_0x2546b1){if(_0x2546b1){return _0x2546b1?{'count':_0x2f0934,'rows':_0x2546b1}:null;}})[_0xbfcb('0x1c')](respondWithResult(_0xe35368,null))[_0xbfcb('0x27')](handleError(_0xe35368,null));};exports[_0xbfcb('0x5a')]=function(_0x31b5fc,_0x5328da,_0x2212cd){var _0x19dd1f={};var _0x3d677a={};var _0x472fb9;var _0x16a620;return db[_0xbfcb('0x36')][_0xbfcb('0x52')]({'where':{'id':_0x31b5fc[_0xbfcb('0x58')]['id']}})[_0xbfcb('0x1c')](handleEntityNotFound(_0x5328da,null))[_0xbfcb('0x1c')](function(_0x3e9934){if(_0x3e9934){_0x472fb9=_0x3e9934;_0x3d677a[_0xbfcb('0x37')]=_['keys'](db['Dynamics365Field'][_0xbfcb('0x4e')]);_0x3d677a[_0xbfcb('0x39')]=_[_0xbfcb('0x38')](_0x31b5fc[_0xbfcb('0x39')]);_0x3d677a[_0xbfcb('0x43')]=_[_0xbfcb('0x3b')](_0x3d677a[_0xbfcb('0x37')],_0x3d677a[_0xbfcb('0x39')]);_0x19dd1f['attributes']=_[_0xbfcb('0x3b')](_0x3d677a[_0xbfcb('0x37')],qs[_0xbfcb('0x3c')](_0x31b5fc[_0xbfcb('0x39')][_0xbfcb('0x3c')]));_0x19dd1f['attributes']=_0x19dd1f[_0xbfcb('0x3a')]['length']?_0x19dd1f[_0xbfcb('0x3a')]:_0x3d677a[_0xbfcb('0x37')];_0x19dd1f['order']=qs['sort'](_0x31b5fc[_0xbfcb('0x39')][_0xbfcb('0x40')]);_0x19dd1f[_0xbfcb('0x41')]=qs[_0xbfcb('0x43')](_[_0xbfcb('0x42')](_0x31b5fc[_0xbfcb('0x39')],_0x3d677a['filters']));if(_0x31b5fc[_0xbfcb('0x39')][_0xbfcb('0x44')]){_0x19dd1f[_0xbfcb('0x41')]=_[_0xbfcb('0x53')](_0x19dd1f[_0xbfcb('0x41')],{'$or':_[_0xbfcb('0x45')](_0x19dd1f[_0xbfcb('0x3a')],function(_0x2c4b3c){var _0x5bdd61={};_0x5bdd61[_0x2c4b3c]={'$like':'%'+_0x31b5fc[_0xbfcb('0x39')][_0xbfcb('0x44')]+'%'};return _0x5bdd61;})});}_0x19dd1f=_['merge']({},_0x19dd1f,_0x31b5fc['options']);return _0x472fb9[_0xbfcb('0x5a')](_0x19dd1f);}})['then'](function(_0x547586){if(_0x547586){_0x16a620=_0x547586[_0xbfcb('0x3d')];if(!_0x31b5fc['query'][_0xbfcb('0x3e')](_0xbfcb('0x55'))){_0x19dd1f[_0xbfcb('0x2d')]=qs['limit'](_0x31b5fc[_0xbfcb('0x39')][_0xbfcb('0x2d')]);_0x19dd1f[_0xbfcb('0x2c')]=qs['offset'](_0x31b5fc['query'][_0xbfcb('0x2c')]);}return _0x472fb9[_0xbfcb('0x5a')](_0x19dd1f);}})[_0xbfcb('0x1c')](function(_0x4fd470){if(_0x4fd470){return _0x4fd470?{'count':_0x16a620,'rows':_0x4fd470}:null;}})[_0xbfcb('0x1c')](respondWithResult(_0x5328da,null))['catch'](handleError(_0x5328da,null));};
\ No newline at end of file
+var _0x3423=['json','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','Dynamics365Configuration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','field','options','count','includeAll','findAll','include','create','body','update','find','params','getFields','findOne','length','order','getSubjects','Dynamics365Field','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end'];(function(_0x2f9fc2,_0x2e7b68){var _0x17b163=function(_0x1d07d5){while(--_0x1d07d5){_0x2f9fc2['push'](_0x2f9fc2['shift']());}};_0x17b163(++_0x2e7b68);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3342('0x0'));var zipdir=require(_0x3342('0x1'));var jsonpatch=require(_0x3342('0x2'));var rp=require(_0x3342('0x3'));var moment=require(_0x3342('0x4'));var BPromise=require(_0x3342('0x5'));var Mustache=require(_0x3342('0x6'));var util=require(_0x3342('0x7'));var path=require(_0x3342('0x8'));var sox=require(_0x3342('0x9'));var csv=require(_0x3342('0xa'));var ejs=require(_0x3342('0xb'));var fs=require('fs');var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0xa'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x3342('0x12'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x3342('0x13'));var config=require(_0x3342('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3342('0x15'));var client=jayson['client'][_0x3342('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x36e1f4,_0x592ba8,_0x3e418d,_0x334f0e){return new BPromise(function(_0x38e3f7,_0xe4689e){var _0x61fcc0=_0x334f0e||client;return _0x61fcc0[_0x3342('0x17')](_0x36e1f4,_0x3e418d)[_0x3342('0x18')](function(_0x59be1d){logger[_0x3342('0x19')](_0x3342('0x1a'),_0x592ba8,'request\x20sent');logger[_0x3342('0x1b')](_0x3342('0x1c'),_0x592ba8,'request\x20sent',JSON['stringify'](_0x59be1d));if(_0x59be1d[_0x3342('0x1d')]){if(_0x59be1d[_0x3342('0x1d')][_0x3342('0x1e')]===0x1f4){logger[_0x3342('0x1d')](_0x3342('0x1a'),_0x592ba8,_0x59be1d[_0x3342('0x1d')][_0x3342('0x1f')]);return _0xe4689e(_0x59be1d[_0x3342('0x1d')][_0x3342('0x1f')]);}logger['error'](_0x3342('0x1a'),_0x592ba8,_0x59be1d[_0x3342('0x1d')][_0x3342('0x1f')]);return _0x38e3f7(_0x59be1d['error'][_0x3342('0x1f')]);}else{logger[_0x3342('0x19')]('Dynamics365Configuration,\x20%s,\x20%s',_0x592ba8,_0x3342('0x20'));_0x38e3f7(_0x59be1d[_0x3342('0x21')]['message']);}})[_0x3342('0x22')](function(_0x5a0658){logger[_0x3342('0x1d')](_0x3342('0x1a'),_0x592ba8,_0x5a0658);_0xe4689e(_0x5a0658);});});}function respondWithStatusCode(_0xa23053,_0x2dbad1){_0x2dbad1=_0x2dbad1||0xcc;return function(_0xd2b87d){if(_0xd2b87d){return _0xa23053[_0x3342('0x23')](_0x2dbad1);}return _0xa23053[_0x3342('0x24')](_0x2dbad1)[_0x3342('0x25')]();};}function respondWithResult(_0x5d4f14,_0x30ffc9){_0x30ffc9=_0x30ffc9||0xc8;return function(_0x517db5){if(_0x517db5){return _0x5d4f14['status'](_0x30ffc9)[_0x3342('0x26')](_0x517db5);}};}function respondWithFilteredResult(_0x52ba65,_0x5d2f0b){return function(_0x247ee4){if(_0x247ee4){var _0x58f0f5=_0x247ee4['count'],_0x37df78=_0x5d2f0b[_0x3342('0x27')],_0x543ec3=_0x5d2f0b[_0x3342('0x27')]+_0x5d2f0b[_0x3342('0x28')],_0x524286;if(_0x543ec3>=_0x58f0f5){_0x543ec3=_0x58f0f5;_0x524286=0xc8;}else{_0x524286=0xce;}_0x52ba65['status'](_0x524286);return _0x52ba65[_0x3342('0x29')](_0x3342('0x2a'),_0x37df78+'-'+_0x543ec3+'/'+_0x58f0f5)[_0x3342('0x26')](_0x247ee4);}return null;};}function patchUpdates(_0x272a52){return function(_0x4fbfb7){try{jsonpatch[_0x3342('0x2b')](_0x4fbfb7,_0x272a52,!![]);}catch(_0x3d6810){return BPromise[_0x3342('0x2c')](_0x3d6810);}return _0x4fbfb7[_0x3342('0x2d')]();};}function saveUpdates(_0xf82530,_0x2cc691){return function(_0x135760){if(_0x135760){return _0x135760['update'](_0xf82530)[_0x3342('0x18')](function(_0x4dafa3){return _0x4dafa3;});}return null;};}function removeEntity(_0x9c9def,_0x407f8c){return function(_0x508f87){if(_0x508f87){return _0x508f87[_0x3342('0x2e')]()[_0x3342('0x18')](function(){_0x9c9def[_0x3342('0x24')](0xcc)[_0x3342('0x25')]();});}};}function handleEntityNotFound(_0x498ded,_0x3301c1){return function(_0x246944){if(!_0x246944){_0x498ded[_0x3342('0x23')](0x194);}return _0x246944;};}function handleError(_0x948535,_0x3156b5){_0x3156b5=_0x3156b5||0x1f4;return function(_0x26528f){logger[_0x3342('0x1d')](_0x26528f[_0x3342('0x2f')]);if(_0x26528f[_0x3342('0x30')]){delete _0x26528f[_0x3342('0x30')];}_0x948535[_0x3342('0x24')](_0x3156b5)[_0x3342('0x31')](_0x26528f);};}exports['index']=function(_0x478c8d,_0x1dc9b3){var _0x58157e={},_0x400019={},_0x464650={'count':0x0,'rows':[]};var _0x1a74d3=db[_0x3342('0x32')][_0x3342('0x33')];_0x400019[_0x3342('0x34')]=_[_0x3342('0x35')](_0x1a74d3);_0x400019['query']=_[_0x3342('0x35')](_0x478c8d[_0x3342('0x36')]);_0x400019[_0x3342('0x37')]=_[_0x3342('0x38')](_0x400019[_0x3342('0x34')],_0x400019['query']);_0x58157e[_0x3342('0x39')]=_['intersection'](_0x400019[_0x3342('0x34')],qs[_0x3342('0x3a')](_0x478c8d[_0x3342('0x36')][_0x3342('0x3a')]));_0x58157e['attributes']=_0x58157e[_0x3342('0x39')]['length']?_0x58157e[_0x3342('0x39')]:_0x400019[_0x3342('0x34')];if(!_0x478c8d[_0x3342('0x36')][_0x3342('0x3b')](_0x3342('0x3c'))){_0x58157e[_0x3342('0x28')]=qs[_0x3342('0x28')](_0x478c8d['query'][_0x3342('0x28')]);_0x58157e[_0x3342('0x27')]=qs['offset'](_0x478c8d[_0x3342('0x36')][_0x3342('0x27')]);}_0x58157e['order']=qs[_0x3342('0x3d')](_0x478c8d[_0x3342('0x36')]['sort']);_0x58157e['where']=qs['filters'](_[_0x3342('0x3e')](_0x478c8d[_0x3342('0x36')],_0x400019['filters']));if(_0x478c8d[_0x3342('0x36')][_0x3342('0x3f')]){_0x58157e[_0x3342('0x40')]=_[_0x3342('0x41')](_0x58157e[_0x3342('0x40')],{'$or':_[_0x3342('0x42')](_0x1a74d3,function(_0x34de7b){if(_0x34de7b[_0x3342('0x43')]['key']!=='VIRTUAL'){var _0x472ed2={};_0x472ed2[_0x34de7b[_0x3342('0x44')]]={'$like':'%'+_0x478c8d[_0x3342('0x36')][_0x3342('0x3f')]+'%'};return _0x472ed2;}})});}_0x58157e=_[_0x3342('0x41')]({},_0x58157e,_0x478c8d[_0x3342('0x45')]);var _0x5e24a1={'where':_0x58157e[_0x3342('0x40')]};return db[_0x3342('0x32')][_0x3342('0x46')](_0x5e24a1)[_0x3342('0x18')](function(_0x64e352){_0x464650[_0x3342('0x46')]=_0x64e352;if(_0x478c8d['query'][_0x3342('0x47')]){_0x58157e['include']=[{'all':!![]}];}return db[_0x3342('0x32')][_0x3342('0x48')](_0x58157e);})[_0x3342('0x18')](function(_0x37166f){_0x464650['rows']=_0x37166f;return _0x464650;})[_0x3342('0x18')](respondWithFilteredResult(_0x1dc9b3,_0x58157e))[_0x3342('0x22')](handleError(_0x1dc9b3,null));};exports['show']=function(_0x1f54a8,_0x302159){var _0x169549={'raw':![],'where':{'id':_0x1f54a8['params']['id']}},_0x16cebb={};_0x16cebb[_0x3342('0x34')]=_[_0x3342('0x35')](db['Dynamics365Configuration'][_0x3342('0x33')]);_0x16cebb['query']=_['keys'](_0x1f54a8[_0x3342('0x36')]);_0x16cebb[_0x3342('0x37')]=_[_0x3342('0x38')](_0x16cebb[_0x3342('0x34')],_0x16cebb[_0x3342('0x36')]);_0x169549[_0x3342('0x39')]=_[_0x3342('0x38')](_0x16cebb['model'],qs['fields'](_0x1f54a8[_0x3342('0x36')]['fields']));_0x169549[_0x3342('0x39')]=_0x169549['attributes']['length']?_0x169549['attributes']:_0x16cebb[_0x3342('0x34')];if(_0x1f54a8[_0x3342('0x36')][_0x3342('0x47')]){_0x169549[_0x3342('0x49')]=[{'all':!![]}];}_0x169549=_['merge']({},_0x169549,_0x1f54a8[_0x3342('0x45')]);return db[_0x3342('0x32')]['find'](_0x169549)[_0x3342('0x18')](handleEntityNotFound(_0x302159,null))[_0x3342('0x18')](respondWithResult(_0x302159,null))[_0x3342('0x22')](handleError(_0x302159,null));};exports['create']=function(_0x189b68,_0x1497d9){return db[_0x3342('0x32')][_0x3342('0x4a')](_0x189b68[_0x3342('0x4b')],{})['then'](respondWithResult(_0x1497d9,0xc9))[_0x3342('0x22')](handleError(_0x1497d9,null));};exports[_0x3342('0x4c')]=function(_0x23f24d,_0x3d9a0a){if(_0x23f24d[_0x3342('0x4b')]['id']){delete _0x23f24d[_0x3342('0x4b')]['id'];}return db[_0x3342('0x32')][_0x3342('0x4d')]({'where':{'id':_0x23f24d[_0x3342('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d9a0a,null))[_0x3342('0x18')](saveUpdates(_0x23f24d['body'],null))[_0x3342('0x18')](respondWithResult(_0x3d9a0a,null))['catch'](handleError(_0x3d9a0a,null));};exports['destroy']=function(_0x5bff74,_0x47b9b2){return db[_0x3342('0x32')][_0x3342('0x4d')]({'where':{'id':_0x5bff74[_0x3342('0x4e')]['id']}})[_0x3342('0x18')](handleEntityNotFound(_0x47b9b2,null))[_0x3342('0x18')](removeEntity(_0x47b9b2,null))[_0x3342('0x22')](handleError(_0x47b9b2,null));};exports[_0x3342('0x4f')]=function(_0x421ed4,_0x2938e0,_0x394418){var _0x4131a1={};var _0x561812={};var _0x47d138;var _0x11719c;return db['Dynamics365Configuration'][_0x3342('0x50')]({'where':{'id':_0x421ed4['params']['id']}})['then'](handleEntityNotFound(_0x2938e0,null))[_0x3342('0x18')](function(_0x43d39f){if(_0x43d39f){_0x47d138=_0x43d39f;_0x561812[_0x3342('0x34')]=_['keys'](db['Dynamics365Field'][_0x3342('0x33')]);_0x561812[_0x3342('0x36')]=_['keys'](_0x421ed4[_0x3342('0x36')]);_0x561812[_0x3342('0x37')]=_[_0x3342('0x38')](_0x561812['model'],_0x561812[_0x3342('0x36')]);_0x4131a1[_0x3342('0x39')]=_[_0x3342('0x38')](_0x561812[_0x3342('0x34')],qs[_0x3342('0x3a')](_0x421ed4[_0x3342('0x36')][_0x3342('0x3a')]));_0x4131a1['attributes']=_0x4131a1['attributes'][_0x3342('0x51')]?_0x4131a1['attributes']:_0x561812[_0x3342('0x34')];_0x4131a1[_0x3342('0x52')]=qs[_0x3342('0x3d')](_0x421ed4[_0x3342('0x36')][_0x3342('0x3d')]);_0x4131a1['where']=qs[_0x3342('0x37')](_[_0x3342('0x3e')](_0x421ed4['query'],_0x561812[_0x3342('0x37')]));if(_0x421ed4[_0x3342('0x36')][_0x3342('0x3f')]){_0x4131a1[_0x3342('0x40')]=_[_0x3342('0x41')](_0x4131a1[_0x3342('0x40')],{'$or':_[_0x3342('0x42')](_0x4131a1[_0x3342('0x39')],function(_0x16c3f3){var _0x36eec8={};_0x36eec8[_0x16c3f3]={'$like':'%'+_0x421ed4[_0x3342('0x36')][_0x3342('0x3f')]+'%'};return _0x36eec8;})});}_0x4131a1=_[_0x3342('0x41')]({},_0x4131a1,_0x421ed4['options']);return _0x47d138['getFields'](_0x4131a1);}})[_0x3342('0x18')](function(_0x4672b5){if(_0x4672b5){_0x11719c=_0x4672b5[_0x3342('0x51')];if(!_0x421ed4[_0x3342('0x36')]['hasOwnProperty']('nolimit')){_0x4131a1[_0x3342('0x28')]=qs[_0x3342('0x28')](_0x421ed4[_0x3342('0x36')][_0x3342('0x28')]);_0x4131a1[_0x3342('0x27')]=qs[_0x3342('0x27')](_0x421ed4[_0x3342('0x36')][_0x3342('0x27')]);}return _0x47d138[_0x3342('0x4f')](_0x4131a1);}})[_0x3342('0x18')](function(_0x4887d4){if(_0x4887d4){return _0x4887d4?{'count':_0x11719c,'rows':_0x4887d4}:null;}})[_0x3342('0x18')](respondWithResult(_0x2938e0,null))['catch'](handleError(_0x2938e0,null));};exports[_0x3342('0x53')]=function(_0xba7c0e,_0x536fbc,_0x18cadb){var _0x3506d4={};var _0x5c9720={};var _0x317836;var _0x3624be;return db[_0x3342('0x32')][_0x3342('0x50')]({'where':{'id':_0xba7c0e[_0x3342('0x4e')]['id']}})[_0x3342('0x18')](handleEntityNotFound(_0x536fbc,null))[_0x3342('0x18')](function(_0x57b8ac){if(_0x57b8ac){_0x317836=_0x57b8ac;_0x5c9720[_0x3342('0x34')]=_['keys'](db['Dynamics365Field'][_0x3342('0x33')]);_0x5c9720[_0x3342('0x36')]=_[_0x3342('0x35')](_0xba7c0e[_0x3342('0x36')]);_0x5c9720[_0x3342('0x37')]=_[_0x3342('0x38')](_0x5c9720[_0x3342('0x34')],_0x5c9720[_0x3342('0x36')]);_0x3506d4['attributes']=_[_0x3342('0x38')](_0x5c9720[_0x3342('0x34')],qs[_0x3342('0x3a')](_0xba7c0e[_0x3342('0x36')][_0x3342('0x3a')]));_0x3506d4[_0x3342('0x39')]=_0x3506d4[_0x3342('0x39')]['length']?_0x3506d4[_0x3342('0x39')]:_0x5c9720[_0x3342('0x34')];_0x3506d4[_0x3342('0x52')]=qs[_0x3342('0x3d')](_0xba7c0e[_0x3342('0x36')][_0x3342('0x3d')]);_0x3506d4['where']=qs['filters'](_['pick'](_0xba7c0e[_0x3342('0x36')],_0x5c9720[_0x3342('0x37')]));if(_0xba7c0e[_0x3342('0x36')][_0x3342('0x3f')]){_0x3506d4[_0x3342('0x40')]=_[_0x3342('0x41')](_0x3506d4[_0x3342('0x40')],{'$or':_[_0x3342('0x42')](_0x3506d4['attributes'],function(_0x9763d5){var _0x1b24d2={};_0x1b24d2[_0x9763d5]={'$like':'%'+_0xba7c0e[_0x3342('0x36')][_0x3342('0x3f')]+'%'};return _0x1b24d2;})});}_0x3506d4=_['merge']({},_0x3506d4,_0xba7c0e[_0x3342('0x45')]);return _0x317836[_0x3342('0x53')](_0x3506d4);}})[_0x3342('0x18')](function(_0x3ec056){if(_0x3ec056){_0x3624be=_0x3ec056[_0x3342('0x51')];if(!_0xba7c0e[_0x3342('0x36')][_0x3342('0x3b')](_0x3342('0x3c'))){_0x3506d4[_0x3342('0x28')]=qs['limit'](_0xba7c0e[_0x3342('0x36')][_0x3342('0x28')]);_0x3506d4['offset']=qs[_0x3342('0x27')](_0xba7c0e['query'][_0x3342('0x27')]);}return _0x317836['getSubjects'](_0x3506d4);}})[_0x3342('0x18')](function(_0x5b2f46){if(_0x5b2f46){return _0x5b2f46?{'count':_0x3624be,'rows':_0x5b2f46}:null;}})[_0x3342('0x18')](respondWithResult(_0x536fbc,null))[_0x3342('0x22')](handleError(_0x536fbc,null));};exports['getDescriptions']=function(_0x3a24b7,_0xebdf33,_0x5f1acc){var _0xe5acb2={};var _0x24c9ef={};var _0x380463;var _0xdb9eb9;return db[_0x3342('0x32')][_0x3342('0x50')]({'where':{'id':_0x3a24b7['params']['id']}})[_0x3342('0x18')](handleEntityNotFound(_0xebdf33,null))[_0x3342('0x18')](function(_0x32c341){if(_0x32c341){_0x380463=_0x32c341;_0x24c9ef[_0x3342('0x34')]=_[_0x3342('0x35')](db[_0x3342('0x54')][_0x3342('0x33')]);_0x24c9ef[_0x3342('0x36')]=_[_0x3342('0x35')](_0x3a24b7[_0x3342('0x36')]);_0x24c9ef['filters']=_[_0x3342('0x38')](_0x24c9ef[_0x3342('0x34')],_0x24c9ef[_0x3342('0x36')]);_0xe5acb2['attributes']=_['intersection'](_0x24c9ef[_0x3342('0x34')],qs['fields'](_0x3a24b7['query'][_0x3342('0x3a')]));_0xe5acb2[_0x3342('0x39')]=_0xe5acb2['attributes'][_0x3342('0x51')]?_0xe5acb2['attributes']:_0x24c9ef[_0x3342('0x34')];_0xe5acb2['order']=qs['sort'](_0x3a24b7[_0x3342('0x36')][_0x3342('0x3d')]);_0xe5acb2[_0x3342('0x40')]=qs['filters'](_['pick'](_0x3a24b7[_0x3342('0x36')],_0x24c9ef['filters']));if(_0x3a24b7[_0x3342('0x36')][_0x3342('0x3f')]){_0xe5acb2[_0x3342('0x40')]=_[_0x3342('0x41')](_0xe5acb2['where'],{'$or':_['map'](_0xe5acb2[_0x3342('0x39')],function(_0x2be9e6){var _0x58154e={};_0x58154e[_0x2be9e6]={'$like':'%'+_0x3a24b7[_0x3342('0x36')]['filter']+'%'};return _0x58154e;})});}_0xe5acb2=_[_0x3342('0x41')]({},_0xe5acb2,_0x3a24b7[_0x3342('0x45')]);return _0x380463[_0x3342('0x55')](_0xe5acb2);}})[_0x3342('0x18')](function(_0x22b415){if(_0x22b415){_0xdb9eb9=_0x22b415['length'];if(!_0x3a24b7['query']['hasOwnProperty'](_0x3342('0x3c'))){_0xe5acb2[_0x3342('0x28')]=qs[_0x3342('0x28')](_0x3a24b7['query'][_0x3342('0x28')]);_0xe5acb2[_0x3342('0x27')]=qs[_0x3342('0x27')](_0x3a24b7[_0x3342('0x36')][_0x3342('0x27')]);}return _0x380463[_0x3342('0x55')](_0xe5acb2);}})['then'](function(_0x100e23){if(_0x100e23){return _0x100e23?{'count':_0xdb9eb9,'rows':_0x100e23}:null;}})['then'](respondWithResult(_0xebdf33,null))['catch'](handleError(_0xebdf33,null));};
\ No newline at end of file