Built motion from commit 19a84241.|2.5.34
[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 _0x4737=['shelljs','lodash','./utils','../../../../config/logger','routing','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','body','error','stringify','validate'];(function(_0x43067d,_0x558e14){var _0x13004a=function(_0x57df31){while(--_0x57df31){_0x43067d['push'](_0x43067d['shift']());}};_0x13004a(++_0x558e14);}(_0x4737,0x141));var _0x7473=function(_0x4e899c,_0x5179cd){_0x4e899c=_0x4e899c-0x0;var _0x71ea24=_0x4737[_0x4e899c];return _0x71ea24;};'use strict';var schema=require(_0x7473('0x0'));var sh=require(_0x7473('0x1'));var _=require(_0x7473('0x2'));var utils=require(_0x7473('0x3'));var logger=require(_0x7473('0x4'))(_0x7473('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x7473('0x6')]=function(_0x47e988,_0x254172){return function(_0x2a17e0){try{var _0x3043e7={'command':_0x254172[0x0]};var _0x509ed8=system[_0x7473('0x0')](_0x3043e7,{'typecast':!![]});if(_0x509ed8[_0x7473('0x7')]){logger['error'](_0x7473('0x8'),_0x47e988,_[_0x7473('0x9')](_0x509ed8,_0x7473('0xa'))[_0x7473('0xb')](',\x20'));logger[_0x7473('0xc')](_0x7473('0xd'),_0x47e988);_0x2a17e0['next']();}else{var _0x52f315=this;var _0x11fb0a=utils['getMustacheRender'](_0x254172[0x0],this);logger['info'](_0x7473('0xe'),_0x47e988,_0x11fb0a);sh[_0x7473('0xf')](_[_0x7473('0x10')](_0x11fb0a),function(_0x44b3da,_0x1defc1){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x47e988,_0x44b3da);if(_0x44b3da==0x0){var _0x360d1f=_0x1defc1[_0x7473('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x7473('0x12')](_0x254172[0x1])||_[_0x7473('0x13')](_0x254172[0x1])){logger[_0x7473('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x47e988);_0x52f315['body'][_0x254172[0x1]]=_0x360d1f;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x47e988,_0x254172[0x1],_0x360d1f);_0x52f315[_0x7473('0x14')][_0x254172[0x1]]=_0x360d1f;}}_0x2a17e0['next']();});}}catch(_0x311bc0){logger[_0x7473('0x15')](_0x7473('0x8'),_0x47e988,_['isObject'](_0x311bc0)?JSON[_0x7473('0x16')](_0x311bc0):_0x311bc0);logger[_0x7473('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x47e988);_0x2a17e0['next']();}};};