Built motion from commit (unavailable).|2.5.12
[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 _0x406f=['string','consequence','validate','error','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','[%s][SYSTEM]\x20%s','shelljs','lodash','./utils','routing'];(function(_0x41e7cc,_0x3e893e){var _0x4a79cf=function(_0x2056d7){while(--_0x2056d7){_0x41e7cc['push'](_0x41e7cc['shift']());}};_0x4a79cf(++_0x3e893e);}(_0x406f,0x13e));var _0xf406=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x406f[_0x411017];return _0x2adeea;};'use strict';var schema=require('validate');var sh=require(_0xf406('0x0'));var _=require(_0xf406('0x1'));var utils=require(_0xf406('0x2'));var logger=require('../../../../config/logger')(_0xf406('0x3'));var system=schema({'command':{'type':_0xf406('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf406('0x5')]=function(_0x4fc070,_0x5554f6){return function(_0x39bae7){try{var _0x30bad2={'command':_0x5554f6[0x0]};var _0x217940=system[_0xf406('0x6')](_0x30bad2,{'typecast':!![]});if(_0x217940['length']){logger[_0xf406('0x7')]('[%s][SYSTEM]\x20%s',_0x4fc070,_['map'](_0x217940,_0xf406('0x8'))[_0xf406('0x9')](',\x20'));logger[_0xf406('0xa')](_0xf406('0xb'),_0x4fc070);_0x39bae7[_0xf406('0xc')]();}else{var _0x28ac8b=this;var _0x1d691c=utils[_0xf406('0xd')](_0x5554f6[0x0],this);logger['info'](_0xf406('0xe'),_0x4fc070,_0x1d691c);sh[_0xf406('0xf')](_[_0xf406('0x10')](_0x1d691c),function(_0x557d5d,_0x6a3acf){logger[_0xf406('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x4fc070,_0x557d5d);if(_0x557d5d==0x0){var _0x5026b5=_0x6a3acf[_0xf406('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5554f6[0x1])||_[_0xf406('0x12')](_0x5554f6[0x1])){logger['info'](_0xf406('0x13'),_0x4fc070);_0x28ac8b['body'][_0x5554f6[0x1]]=_0x5026b5;}else{logger['info'](_0xf406('0x14'),_0x4fc070,_0x5554f6[0x1],_0x5026b5);_0x28ac8b[_0xf406('0x15')][_0x5554f6[0x1]]=_0x5026b5;}}_0x39bae7[_0xf406('0xc')]();});}}catch(_0x4d2e09){logger['error'](_0xf406('0x16'),_0x4fc070,_['isObject'](_0x4d2e09)?JSON['stringify'](_0x4d2e09):_0x4d2e09);logger['info'](_0xf406('0xb'),_0x4fc070);_0x39bae7[_0xf406('0xc')]();}};};