Built motion from commit (unavailable).|2.5.22
[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 _0x08d3=['next','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','error','stringify','validate','lodash','./utils','../../../../config/logger','consequence','length','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x120d71,_0x57a0e2){var _0xa896c6=function(_0x143d9f){while(--_0x143d9f){_0x120d71['push'](_0x120d71['shift']());}};_0xa896c6(++_0x57a0e2);}(_0x08d3,0xc7));var _0x308d=function(_0x31abcb,_0x20dff2){_0x31abcb=_0x31abcb-0x0;var _0x214480=_0x08d3[_0x31abcb];return _0x214480;};'use strict';var schema=require(_0x308d('0x0'));var sh=require('shelljs');var _=require(_0x308d('0x1'));var utils=require(_0x308d('0x2'));var logger=require(_0x308d('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x308d('0x4')]=function(_0x1e5ea7,_0x1e9c76){return function(_0x20e8da){try{var _0x115d41={'command':_0x1e9c76[0x0]};var _0x419578=system[_0x308d('0x0')](_0x115d41,{'typecast':!![]});if(_0x419578[_0x308d('0x5')]){logger['error'](_0x308d('0x6'),_0x1e5ea7,_[_0x308d('0x7')](_0x419578,'message')[_0x308d('0x8')](',\x20'));logger[_0x308d('0x9')](_0x308d('0xa'),_0x1e5ea7);_0x20e8da[_0x308d('0xb')]();}else{var _0x4cf288=this;var _0x1d7d83=utils['getMustacheRender'](_0x1e9c76[0x0],this);logger['info'](_0x308d('0xc'),_0x1e5ea7,_0x1d7d83);sh['exec'](_['trim'](_0x1d7d83),function(_0x8259a3,_0xa06fe9){logger[_0x308d('0x9')](_0x308d('0xd'),_0x1e5ea7,_0x8259a3);if(_0x8259a3==0x0){var _0x75a4a4=_0xa06fe9[_0x308d('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x308d('0xf')](_0x1e9c76[0x1])||_[_0x308d('0x10')](_0x1e9c76[0x1])){logger[_0x308d('0x9')](_0x308d('0x11'),_0x1e5ea7);_0x4cf288['body'][_0x1e9c76[0x1]]=_0x75a4a4;}else{logger[_0x308d('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1e5ea7,_0x1e9c76[0x1],_0x75a4a4);_0x4cf288[_0x308d('0x12')][_0x1e9c76[0x1]]=_0x75a4a4;}}_0x20e8da['next']();});}}catch(_0x150af0){logger[_0x308d('0x13')](_0x308d('0x6'),_0x1e5ea7,_['isObject'](_0x150af0)?JSON[_0x308d('0x14')](_0x150af0):_0x150af0);logger[_0x308d('0x9')](_0x308d('0xa'),_0x1e5ea7);_0x20e8da[_0x308d('0xb')]();}};};