21c5b5f49183f89a7b87572d1101eb3477a2a061
[motion2.git] / server / api / setting / setting.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x0896=['now','format','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','count','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','Setting','findAll','rows','show','params','include','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','existsSync','toLower','join','default_logo.svg','root','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.svg','custom','gdpr','securePassword','getPreferred','defaultFavicon','default_preferred.png','default','addFavicon','../../config/license/util','getFavicon','default_favicon.ico','getDate','utcOffset'];(function(_0x4bb560,_0xe9d39c){var _0x1f3e2e=function(_0x31bf82){while(--_0x31bf82){_0x4bb560['push'](_0x4bb560['shift']());}};_0x1f3e2e(++_0xe9d39c);}(_0x0896,0xfb));var _0x6089=function(_0x3214ba,_0x23431a){_0x3214ba=_0x3214ba-0x0;var _0x351297=_0x0896[_0x3214ba];return _0x351297;};'use strict';var emlformat=require(_0x6089('0x0'));var rimraf=require(_0x6089('0x1'));var zipdir=require(_0x6089('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6089('0x3'));var moment=require(_0x6089('0x4'));var BPromise=require(_0x6089('0x5'));var Mustache=require(_0x6089('0x6'));var util=require(_0x6089('0x7'));var path=require(_0x6089('0x8'));var sox=require('sox');var csv=require(_0x6089('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6089('0xa'));var squel=require(_0x6089('0xb'));var crypto=require(_0x6089('0xc'));var jsforce=require(_0x6089('0xd'));var deskjs=require(_0x6089('0xe'));var toCsv=require(_0x6089('0x9'));var querystring=require(_0x6089('0xf'));var Papa=require('papaparse');var Redis=require(_0x6089('0x10'));var authService=require(_0x6089('0x11'));var qs=require(_0x6089('0x12'));var as=require(_0x6089('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6089('0x14'))(_0x6089('0x15'));var utils=require('../../config/utils');var config=require(_0x6089('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6089('0x17'))['db'];var jayson=require(_0x6089('0x18'));var client=jayson['client'][_0x6089('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x17b6d8,_0x4195c9,_0x1db414,_0x3f5623){return new BPromise(function(_0x4cd2d8,_0x1b59dc){var _0x1e121e=_0x3f5623||client;return _0x1e121e[_0x6089('0x1a')](_0x17b6d8,_0x1db414)[_0x6089('0x1b')](function(_0x9e2d98){logger[_0x6089('0x1c')](_0x6089('0x1d'),_0x4195c9,'request\x20sent');logger[_0x6089('0x1e')](_0x6089('0x1f'),_0x4195c9,_0x6089('0x20'),JSON[_0x6089('0x21')](_0x9e2d98));if(_0x9e2d98['error']){if(_0x9e2d98[_0x6089('0x22')][_0x6089('0x23')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x4195c9,_0x9e2d98[_0x6089('0x22')][_0x6089('0x24')]);return _0x1b59dc(_0x9e2d98['error']['message']);}logger[_0x6089('0x22')](_0x6089('0x1d'),_0x4195c9,_0x9e2d98[_0x6089('0x22')][_0x6089('0x24')]);return _0x4cd2d8(_0x9e2d98['error'][_0x6089('0x24')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x4195c9,_0x6089('0x20'));_0x4cd2d8(_0x9e2d98['result'][_0x6089('0x24')]);}})[_0x6089('0x25')](function(_0x33d9e4){logger['error'](_0x6089('0x1d'),_0x4195c9,_0x33d9e4);_0x1b59dc(_0x33d9e4);});});}function respondWithStatusCode(_0x4ca694,_0x271b2c){_0x271b2c=_0x271b2c||0xcc;return function(_0x1fe862){if(_0x1fe862){return _0x4ca694[_0x6089('0x26')](_0x271b2c);}return _0x4ca694[_0x6089('0x27')](_0x271b2c)['end']();};}function respondWithResult(_0x3c9e4a,_0x4bd663){_0x4bd663=_0x4bd663||0xc8;return function(_0x5206c3){if(_0x5206c3){return _0x3c9e4a[_0x6089('0x27')](_0x4bd663)[_0x6089('0x28')](_0x5206c3);}};}function respondWithFilteredResult(_0x545867,_0x5becbe){return function(_0x312269){if(_0x312269){var _0x273b28=typeof _0x5becbe[_0x6089('0x29')]==='undefined'&&typeof _0x5becbe['limit']==='undefined';var _0x495010=_0x312269[_0x6089('0x2a')];var _0x234223=_0x273b28?0x0:_0x5becbe[_0x6089('0x29')];var _0x3672b1=_0x273b28?_0x312269[_0x6089('0x2a')]:_0x5becbe[_0x6089('0x29')]+_0x5becbe[_0x6089('0x2b')];var _0x3dd771;if(_0x3672b1>=_0x495010){_0x3672b1=_0x495010;_0x3dd771=0xc8;}else{_0x3dd771=0xce;}_0x545867[_0x6089('0x27')](_0x3dd771);return _0x545867['set'](_0x6089('0x2c'),_0x234223+'-'+_0x3672b1+'/'+_0x495010)[_0x6089('0x28')](_0x312269);}return null;};}function patchUpdates(_0x16a053){return function(_0x57e2ec){try{jsonpatch[_0x6089('0x2d')](_0x57e2ec,_0x16a053,!![]);}catch(_0x35581a){return BPromise[_0x6089('0x2e')](_0x35581a);}return _0x57e2ec[_0x6089('0x2f')]();};}function saveUpdates(_0x2470fa,_0x14a1f0){return function(_0x689dd9){if(_0x689dd9){return _0x689dd9[_0x6089('0x30')](_0x2470fa)[_0x6089('0x1b')](function(_0x30d2f1){return _0x30d2f1;});}return null;};}function removeEntity(_0x58ffe7,_0x4992dc){return function(_0x502a3f){if(_0x502a3f){return _0x502a3f[_0x6089('0x31')]()['then'](function(){_0x58ffe7[_0x6089('0x27')](0xcc)[_0x6089('0x32')]();});}};}function handleEntityNotFound(_0x562d7a,_0x3abc7a){return function(_0x37de58){if(!_0x37de58){_0x562d7a[_0x6089('0x26')](0x194);}return _0x37de58;};}function handleError(_0x31b268,_0x3a7341){_0x3a7341=_0x3a7341||0x1f4;return function(_0x475383){logger['error'](_0x475383[_0x6089('0x33')]);if(_0x475383[_0x6089('0x34')]){delete _0x475383['name'];}_0x31b268[_0x6089('0x27')](_0x3a7341)['send'](_0x475383);};}exports[_0x6089('0x35')]=function(_0x14b917,_0x1f4d82){var _0xb4120={},_0x153b4d={},_0x109e45={'count':0x0,'rows':[]};var _0x4c71ff=_[_0x6089('0x36')](db['Setting'][_0x6089('0x37')],function(_0x37f15d){return{'name':_0x37f15d[_0x6089('0x38')],'type':_0x37f15d['type'][_0x6089('0x39')]};});_0x153b4d['model']=_[_0x6089('0x36')](_0x4c71ff,_0x6089('0x34'));_0x153b4d[_0x6089('0x3a')]=_[_0x6089('0x3b')](_0x14b917[_0x6089('0x3a')]);_0x153b4d[_0x6089('0x3c')]=_[_0x6089('0x3d')](_0x153b4d[_0x6089('0x3e')],_0x153b4d[_0x6089('0x3a')]);_0xb4120[_0x6089('0x3f')]=_[_0x6089('0x3d')](_0x153b4d[_0x6089('0x3e')],qs[_0x6089('0x40')](_0x14b917[_0x6089('0x3a')][_0x6089('0x40')]));_0xb4120[_0x6089('0x3f')]=_0xb4120[_0x6089('0x3f')][_0x6089('0x41')]?_0xb4120[_0x6089('0x3f')]:_0x153b4d[_0x6089('0x3e')];if(!_0x14b917[_0x6089('0x3a')]['hasOwnProperty']('nolimit')){_0xb4120[_0x6089('0x2b')]=qs[_0x6089('0x2b')](_0x14b917[_0x6089('0x3a')][_0x6089('0x2b')]);_0xb4120[_0x6089('0x29')]=qs['offset'](_0x14b917[_0x6089('0x3a')][_0x6089('0x29')]);}_0xb4120[_0x6089('0x42')]=qs[_0x6089('0x43')](_0x14b917[_0x6089('0x3a')][_0x6089('0x43')]);_0xb4120[_0x6089('0x44')]=qs[_0x6089('0x3c')](_['pick'](_0x14b917[_0x6089('0x3a')],_0x153b4d[_0x6089('0x3c')]),_0x4c71ff);if(_0x14b917[_0x6089('0x3a')][_0x6089('0x45')]){_0xb4120[_0x6089('0x44')]=_[_0x6089('0x46')](_0xb4120['where'],{'$or':_[_0x6089('0x36')](_0x4c71ff,function(_0x3c9e72){if(_0x3c9e72[_0x6089('0x47')]!==_0x6089('0x48')){var _0x1fe738={};_0x1fe738[_0x3c9e72[_0x6089('0x34')]]={'$like':'%'+_0x14b917['query']['filter']+'%'};return _0x1fe738;}})});}_0xb4120=_[_0x6089('0x46')]({},_0xb4120,_0x14b917[_0x6089('0x49')]);var _0x209af2={'where':_0xb4120[_0x6089('0x44')]};return db['Setting'][_0x6089('0x2a')](_0x209af2)[_0x6089('0x1b')](function(_0x45623f){_0x109e45['count']=_0x45623f;if(_0x14b917[_0x6089('0x3a')][_0x6089('0x4a')]){_0xb4120['include']=[{'all':!![]}];}return db[_0x6089('0x4b')][_0x6089('0x4c')](_0xb4120);})[_0x6089('0x1b')](function(_0x1c4710){_0x109e45[_0x6089('0x4d')]=_0x1c4710;return _0x109e45;})[_0x6089('0x1b')](respondWithFilteredResult(_0x1f4d82,_0xb4120))[_0x6089('0x25')](handleError(_0x1f4d82,null));};exports[_0x6089('0x4e')]=function(_0x2b80b8,_0x33d529){var _0x973631={'raw':![],'where':{'id':_0x2b80b8[_0x6089('0x4f')]['id']}},_0x9cdd4={};_0x9cdd4[_0x6089('0x3e')]=_['keys'](db[_0x6089('0x4b')]['rawAttributes']);_0x9cdd4['query']=_[_0x6089('0x3b')](_0x2b80b8['query']);_0x9cdd4['filters']=_[_0x6089('0x3d')](_0x9cdd4[_0x6089('0x3e')],_0x9cdd4[_0x6089('0x3a')]);_0x973631['attributes']=_[_0x6089('0x3d')](_0x9cdd4[_0x6089('0x3e')],qs[_0x6089('0x40')](_0x2b80b8[_0x6089('0x3a')]['fields']));_0x973631[_0x6089('0x3f')]=_0x973631[_0x6089('0x3f')]['length']?_0x973631['attributes']:_0x9cdd4[_0x6089('0x3e')];if(_0x2b80b8[_0x6089('0x3a')][_0x6089('0x4a')]){_0x973631[_0x6089('0x50')]=[{'all':!![]}];}_0x973631=_[_0x6089('0x46')]({},_0x973631,_0x2b80b8['options']);return db[_0x6089('0x4b')][_0x6089('0x51')](_0x973631)[_0x6089('0x1b')](handleEntityNotFound(_0x33d529,null))['then'](respondWithResult(_0x33d529,null))[_0x6089('0x25')](handleError(_0x33d529,null));};exports[_0x6089('0x30')]=function(_0x596de6,_0x59845a){if(_0x596de6['body']['id']){delete _0x596de6[_0x6089('0x52')]['id'];}return db[_0x6089('0x4b')][_0x6089('0x51')]({'where':{'id':_0x596de6['params']['id']}})[_0x6089('0x1b')](handleEntityNotFound(_0x59845a,null))[_0x6089('0x1b')](saveUpdates(_0x596de6[_0x6089('0x52')],null))[_0x6089('0x1b')](respondWithResult(_0x59845a,null))['catch'](handleError(_0x59845a,null));};exports[_0x6089('0x53')]=function(_0x4f9d7b,_0x461bf4,_0x2bca62){if(_0x4f9d7b[_0x6089('0x54')]&&_0x4f9d7b[_0x6089('0x54')][_0x6089('0x55')]){_0x4f9d7b[_0x6089('0x52')][_0x6089('0x56')]=_0x4f9d7b[_0x6089('0x54')]['filename'];}return db[_0x6089('0x4b')][_0x6089('0x51')]({'where':{'id':_0x4f9d7b[_0x6089('0x4f')]['id']}})['then'](handleEntityNotFound(_0x461bf4,null))[_0x6089('0x1b')](saveUpdates(_0x4f9d7b[_0x6089('0x52')],null))['then'](respondWithResult(_0x461bf4,null))[_0x6089('0x25')](handleError(_0x461bf4,null));};exports[_0x6089('0x57')]=function(_0x196897,_0x3afdcd,_0x5e9814){if(_0x196897['file']&&_0x196897[_0x6089('0x54')][_0x6089('0x55')]){_0x196897[_0x6089('0x52')][_0x6089('0x58')]=_0x196897[_0x6089('0x54')][_0x6089('0x55')];}return db['Setting']['find']({'where':{'id':_0x196897[_0x6089('0x4f')]['id']}})[_0x6089('0x1b')](handleEntityNotFound(_0x3afdcd,null))[_0x6089('0x1b')](saveUpdates(_0x196897[_0x6089('0x52')],null))[_0x6089('0x1b')](respondWithResult(_0x3afdcd,null))['catch'](handleError(_0x3afdcd,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x35c2b4,_0x24a0b1,_0x5db419){var _0xa4c772=_0x6089('0x59');var _0x260c24={'custom':![]};return utilLicense[_0x6089('0x5a')]()[_0x6089('0x1b')](function(_0x14d575){if(_0x14d575){_0x260c24=_0x14d575;}return db[_0x6089('0x4b')][_0x6089('0x51')]({'where':{'id':_0x35c2b4['params']['id']},'attributes':[_0x6089('0x56'),_0x6089('0x58'),_0x6089('0x5b'),_0x6089('0x5c'),'defaultLogo',_0x6089('0x5d'),_0x6089('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x6089('0x1b')](handleEntityNotFound(_0x24a0b1,null))[_0x6089('0x1b')](function(_0x2520f8){if(_0x2520f8){var _0x433815=_0x2520f8[_0x6089('0x56')]&&fs[_0x6089('0x5f')](path['join'](config['root'],_0xa4c772,_[_0x6089('0x60')](_0x2520f8['logo'])))?path[_0x6089('0x61')](config['root'],_0xa4c772,_[_0x6089('0x60')](_0x2520f8['logo'])):path['join'](config['root'],_0xa4c772,_[_0x6089('0x60')](_0x6089('0x62')));var _0xd08f98='default'+_['upperFirst'](_0x6089('0x56'));if(_0x2520f8[_0xd08f98]||!_0x260c24['custom']){_0x433815=path[_0x6089('0x61')](config[_0x6089('0x63')],_0xa4c772,_[_0x6089('0x60')](_0x6089('0x62')));}if(!fs[_0x6089('0x5f')](_0x433815)){throw new db[(_0x6089('0x64'))][(_0x6089('0x65'))](_[_0x6089('0x66')](_0x6089('0x56'))+_0x6089('0x67'));}return _0x24a0b1[_0x6089('0x68')](_0x433815);}})[_0x6089('0x25')](handleError(_0x24a0b1,null));};var utilLicense=require('../../config/license/util');exports[_0x6089('0x69')]=function(_0x2a7778,_0x178f98,_0x2fcc71){var _0x52cfd6=_0x6089('0x59');var _0xf85b7b={'custom':![]};return utilLicense[_0x6089('0x5a')]()['then'](function(_0x522a0b){if(_0x522a0b){_0xf85b7b=_0x522a0b;}return db[_0x6089('0x4b')][_0x6089('0x51')]({'where':{'id':_0x2a7778[_0x6089('0x4f')]['id']},'attributes':['logo',_0x6089('0x58'),_0x6089('0x5b'),'favicon',_0x6089('0x6a'),_0x6089('0x5d'),_0x6089('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x6089('0x1b')](handleEntityNotFound(_0x178f98,null))[_0x6089('0x1b')](function(_0x523b72){if(_0x523b72){var _0x2cc2a9=_0x523b72[_0x6089('0x58')]&&fs[_0x6089('0x5f')](path['join'](config[_0x6089('0x63')],_0x52cfd6,_['toLower'](_0x523b72[_0x6089('0x58')])))?path['join'](config[_0x6089('0x63')],_0x52cfd6,_['toLower'](_0x523b72[_0x6089('0x58')])):path[_0x6089('0x61')](config[_0x6089('0x63')],_0x52cfd6,_[_0x6089('0x60')](_0x6089('0x6b')));var _0x4fd3bd='default'+_['upperFirst']('loginLogo');if(_0x523b72[_0x4fd3bd]||!_0xf85b7b[_0x6089('0x6c')]){_0x2cc2a9=path['join'](config[_0x6089('0x63')],_0x52cfd6,_['toLower'](_0x6089('0x6b')));}if(!fs[_0x6089('0x5f')](_0x2cc2a9)){throw new db[(_0x6089('0x64'))][(_0x6089('0x65'))](_[_0x6089('0x66')]('loginLogo')+_0x6089('0x67'));}return _0x178f98['download'](_0x2cc2a9);}})[_0x6089('0x25')](handleError(_0x178f98,null));};exports[_0x6089('0x6d')]=function(_0x21e79f,_0x4e401f){return db['Setting'][_0x6089('0x51')]({'where':{'id':_0x21e79f[_0x6089('0x4f')]['id']},'attributes':[_0x6089('0x6e')]})[_0x6089('0x1b')](respondWithResult(_0x4e401f,null))['catch'](handleError(_0x4e401f,null));};exports['addPreferred']=function(_0x252f21,_0x56de12,_0x4225a2){if(_0x252f21[_0x6089('0x54')]&&_0x252f21[_0x6089('0x54')][_0x6089('0x55')]){_0x252f21[_0x6089('0x52')]['preferred']=_0x252f21[_0x6089('0x54')][_0x6089('0x55')];}return db['Setting'][_0x6089('0x51')]({'where':{'id':_0x252f21[_0x6089('0x4f')]['id']}})[_0x6089('0x1b')](handleEntityNotFound(_0x56de12,null))[_0x6089('0x1b')](saveUpdates(_0x252f21[_0x6089('0x52')],null))[_0x6089('0x1b')](respondWithResult(_0x56de12,null))['catch'](handleError(_0x56de12,null));};var utilLicense=require('../../config/license/util');exports[_0x6089('0x6f')]=function(_0x22e434,_0x4e1d84,_0x137230){var _0x4b600b=_0x6089('0x59');var _0x443fc0={'custom':![]};return utilLicense[_0x6089('0x5a')]()[_0x6089('0x1b')](function(_0x5b9d18){if(_0x5b9d18){_0x443fc0=_0x5b9d18;}return db[_0x6089('0x4b')][_0x6089('0x51')]({'where':{'id':_0x22e434[_0x6089('0x4f')]['id']},'attributes':['logo',_0x6089('0x58'),_0x6089('0x5b'),_0x6089('0x5c'),_0x6089('0x6a'),_0x6089('0x5d'),_0x6089('0x5e'),_0x6089('0x70')],'raw':!![]});})['then'](handleEntityNotFound(_0x4e1d84,null))['then'](function(_0x530710){if(_0x530710){var _0x4c719f=_0x530710[_0x6089('0x5b')]&&fs[_0x6089('0x5f')](path[_0x6089('0x61')](config['root'],_0x4b600b,_[_0x6089('0x60')](_0x530710[_0x6089('0x5b')])))?path[_0x6089('0x61')](config[_0x6089('0x63')],_0x4b600b,_[_0x6089('0x60')](_0x530710[_0x6089('0x5b')])):path['join'](config[_0x6089('0x63')],_0x4b600b,_[_0x6089('0x60')](_0x6089('0x71')));var _0x5e1088=_0x6089('0x72')+_['upperFirst'](_0x6089('0x5b'));if(_0x530710[_0x5e1088]||!_0x443fc0[_0x6089('0x6c')]||!_0x443fc0['preferred']){_0x4c719f=path[_0x6089('0x61')](config[_0x6089('0x63')],_0x4b600b,_[_0x6089('0x60')]('default_preferred.png'));}if(!fs[_0x6089('0x5f')](_0x4c719f)){throw new db['Sequelize'][(_0x6089('0x65'))](_[_0x6089('0x66')](_0x6089('0x5b'))+_0x6089('0x67'));}return _0x4e1d84[_0x6089('0x68')](_0x4c719f);}})[_0x6089('0x25')](handleError(_0x4e1d84,null));};exports[_0x6089('0x73')]=function(_0x32eef4,_0x56b1c8,_0x424085){if(_0x32eef4['file']&&_0x32eef4[_0x6089('0x54')][_0x6089('0x55')]){_0x32eef4['body'][_0x6089('0x5c')]=_0x32eef4[_0x6089('0x54')][_0x6089('0x55')];}return db[_0x6089('0x4b')][_0x6089('0x51')]({'where':{'id':_0x32eef4[_0x6089('0x4f')]['id']}})['then'](handleEntityNotFound(_0x56b1c8,null))[_0x6089('0x1b')](saveUpdates(_0x32eef4['body'],null))[_0x6089('0x1b')](respondWithResult(_0x56b1c8,null))[_0x6089('0x25')](handleError(_0x56b1c8,null));};var utilLicense=require(_0x6089('0x74'));exports[_0x6089('0x75')]=function(_0x55696a,_0xf0c284,_0x4c86db){var _0x54a1e5='server/files/images/logos';var _0x1f723f={'custom':![]};return utilLicense['getLicense']()[_0x6089('0x1b')](function(_0x32a254){if(_0x32a254){_0x1f723f=_0x32a254;}return db['Setting'][_0x6089('0x51')]({'where':{'id':_0x55696a[_0x6089('0x4f')]['id']},'attributes':[_0x6089('0x56'),_0x6089('0x58'),_0x6089('0x5b'),'favicon',_0x6089('0x6a'),_0x6089('0x5d'),_0x6089('0x5e'),_0x6089('0x70')],'raw':!![]});})[_0x6089('0x1b')](handleEntityNotFound(_0xf0c284,null))[_0x6089('0x1b')](function(_0x5433df){if(_0x5433df){var _0x52d0c2=_0x5433df[_0x6089('0x5c')]&&fs[_0x6089('0x5f')](path[_0x6089('0x61')](config['root'],_0x54a1e5,_[_0x6089('0x60')](_0x5433df[_0x6089('0x5c')])))?path[_0x6089('0x61')](config[_0x6089('0x63')],_0x54a1e5,_[_0x6089('0x60')](_0x5433df[_0x6089('0x5c')])):path[_0x6089('0x61')](config[_0x6089('0x63')],_0x54a1e5,_[_0x6089('0x60')](_0x6089('0x76')));var _0x4535ea=_0x6089('0x72')+_[_0x6089('0x66')](_0x6089('0x5c'));if(_0x5433df[_0x4535ea]||!_0x1f723f[_0x6089('0x6c')]){_0x52d0c2=path[_0x6089('0x61')](config[_0x6089('0x63')],_0x54a1e5,_[_0x6089('0x60')](_0x6089('0x76')));}if(!fs[_0x6089('0x5f')](_0x52d0c2)){throw new db[(_0x6089('0x64'))][(_0x6089('0x65'))](_[_0x6089('0x66')](_0x6089('0x5c'))+_0x6089('0x67'));}return _0xf0c284[_0x6089('0x68')](_0x52d0c2);}})[_0x6089('0x25')](handleError(_0xf0c284,null));};exports[_0x6089('0x77')]=function(_0x437e15,_0x58635b){var _0x242732={'offset':moment()[_0x6089('0x78')]()};_0x242732[_0x6089('0x79')]=moment()[_0x6089('0x78')](_0x242732['offset'])[_0x6089('0x7a')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x58635b[_0x6089('0x27')](0xc8)[_0x6089('0x7b')](_0x242732);};