Built motion from commit 1fa89557.|2.6.10
[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 _0x6ce9=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','next','error','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim'];(function(_0x4f167d,_0x43123b){var _0x5b0026=function(_0x17e85d){while(--_0x17e85d){_0x4f167d['push'](_0x4f167d['shift']());}};_0x5b0026(++_0x43123b);}(_0x6ce9,0xe1));var _0x96ce=function(_0x5d8fee,_0x3dcedb){_0x5d8fee=_0x5d8fee-0x0;var _0x4f93e2=_0x6ce9[_0x5d8fee];return _0x4f93e2;};'use strict';var schema=require(_0x96ce('0x0'));var sh=require(_0x96ce('0x1'));var _=require(_0x96ce('0x2'));var utils=require(_0x96ce('0x3'));var logger=require(_0x96ce('0x4'))(_0x96ce('0x5'));var system=schema({'command':{'type':_0x96ce('0x6'),'required':!![],'message':_0x96ce('0x7')}});exports[_0x96ce('0x8')]=function(_0x4efbcf,_0x18dda0){return function(_0x843780){try{var _0xdf99e9={'command':_0x18dda0[0x0]};var _0x3512c6=system['validate'](_0xdf99e9,{'typecast':!![]});if(_0x3512c6['length']){logger['error'](_0x96ce('0x9'),_0x4efbcf,_[_0x96ce('0xa')](_0x3512c6,_0x96ce('0xb'))[_0x96ce('0xc')](',\x20'));logger[_0x96ce('0xd')](_0x96ce('0xe'),_0x4efbcf);_0x843780['next']();}else{var _0x37db49=this;var _0x747262=utils[_0x96ce('0xf')](_0x18dda0[0x0],this);logger[_0x96ce('0xd')](_0x96ce('0x10'),_0x4efbcf,_0x747262);sh['exec'](_[_0x96ce('0x11')](_0x747262),function(_0x59ab2d,_0x1360a1){logger[_0x96ce('0xd')](_0x96ce('0x12'),_0x4efbcf,_0x59ab2d);if(_0x59ab2d==0x0){var _0x5c4c86=_0x1360a1[_0x96ce('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x96ce('0x14')](_0x18dda0[0x1])||_[_0x96ce('0x15')](_0x18dda0[0x1])){logger[_0x96ce('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x4efbcf);_0x37db49[_0x96ce('0x16')][_0x18dda0[0x1]]=_0x5c4c86;}else{logger[_0x96ce('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x4efbcf,_0x18dda0[0x1],_0x5c4c86);_0x37db49['body'][_0x18dda0[0x1]]=_0x5c4c86;}}_0x843780[_0x96ce('0x17')]();});}}catch(_0x24dc9a){logger[_0x96ce('0x18')]('[%s][SYSTEM]\x20%s',_0x4efbcf,_[_0x96ce('0x19')](_0x24dc9a)?JSON[_0x96ce('0x1a')](_0x24dc9a):_0x24dc9a);logger[_0x96ce('0xd')](_0x96ce('0xe'),_0x4efbcf);_0x843780['next']();}};};