7ab21df4f97215500eca47d53bb9704d9a2464da
[motion2.git] / server / services / routing / server / applications / system.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 _0x60f1=['isEmpty','[%s][SYSTEM]\x20no\x20variable','body','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil'];(function(_0x44366e,_0x22aee0){var _0x2d9af0=function(_0x48361c){while(--_0x48361c){_0x44366e['push'](_0x44366e['shift']());}};_0x2d9af0(++_0x22aee0);}(_0x60f1,0xd4));var _0x160f=function(_0x5e13af,_0x5461e0){_0x5e13af=_0x5e13af-0x0;var _0x3dbfa0=_0x60f1[_0x5e13af];return _0x3dbfa0;};'use strict';var schema=require(_0x160f('0x0'));var sh=require(_0x160f('0x1'));var _=require(_0x160f('0x2'));var utils=require(_0x160f('0x3'));var logger=require(_0x160f('0x4'))('routing');var system=schema({'command':{'type':_0x160f('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x160f('0x6')]=function(_0x4dce8e,_0xd523c1){return function(_0x566f75){try{var _0x1e1d50={'command':_0xd523c1[0x0]};var _0x421980=system['validate'](_0x1e1d50,{'typecast':!![]});if(_0x421980[_0x160f('0x7')]){logger[_0x160f('0x8')](_0x160f('0x9'),_0x4dce8e,_[_0x160f('0xa')](_0x421980,_0x160f('0xb'))[_0x160f('0xc')](',\x20'));logger[_0x160f('0xd')](_0x160f('0xe'),_0x4dce8e);_0x566f75[_0x160f('0xf')]();}else{var _0x59c474=this;var _0x375df5=utils[_0x160f('0x10')](_0xd523c1[0x0],this);logger[_0x160f('0xd')](_0x160f('0x11'),_0x4dce8e,_0x375df5);sh['exec'](_[_0x160f('0x12')](_0x375df5),function(_0x4388f5,_0x309ff0){logger[_0x160f('0xd')](_0x160f('0x13'),_0x4dce8e,_0x4388f5);if(_0x4388f5==0x0){var _0x3464e0=_0x309ff0[_0x160f('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x160f('0x15')](_0xd523c1[0x1])||_[_0x160f('0x16')](_0xd523c1[0x1])){logger[_0x160f('0xd')](_0x160f('0x17'),_0x4dce8e);_0x59c474[_0x160f('0x18')][_0xd523c1[0x1]]=_0x3464e0;}else{logger[_0x160f('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x4dce8e,_0xd523c1[0x1],_0x3464e0);_0x59c474[_0x160f('0x18')][_0xd523c1[0x1]]=_0x3464e0;}}_0x566f75[_0x160f('0xf')]();});}}catch(_0x14ca33){logger[_0x160f('0x8')]('[%s][SYSTEM]\x20%s',_0x4dce8e,_['isObject'](_0x14ca33)?JSON[_0x160f('0x19')](_0x14ca33):_0x14ca33);logger[_0x160f('0xd')](_0x160f('0xe'),_0x4dce8e);_0x566f75[_0x160f('0xf')]();}};};