Built motion from commit (unavailable).|2.5.11
[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 _0x7820=['[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','[%s][SYSTEM]\x20no\x20variable','body','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender'];(function(_0x40dc8f,_0x910e35){var _0x3f08d3=function(_0x4cbb33){while(--_0x4cbb33){_0x40dc8f['push'](_0x40dc8f['shift']());}};_0x3f08d3(++_0x910e35);}(_0x7820,0x1c2));var _0x0782=function(_0x356fa3,_0x1e6c2b){_0x356fa3=_0x356fa3-0x0;var _0x257ae7=_0x7820[_0x356fa3];return _0x257ae7;};'use strict';var schema=require(_0x0782('0x0'));var sh=require(_0x0782('0x1'));var _=require(_0x0782('0x2'));var utils=require(_0x0782('0x3'));var logger=require(_0x0782('0x4'))(_0x0782('0x5'));var system=schema({'command':{'type':_0x0782('0x6'),'required':!![],'message':_0x0782('0x7')}});exports[_0x0782('0x8')]=function(_0x590fca,_0x3e99bc){return function(_0x1a87c3){try{var _0x197a8c={'command':_0x3e99bc[0x0]};var _0x900e3e=system[_0x0782('0x0')](_0x197a8c,{'typecast':!![]});if(_0x900e3e[_0x0782('0x9')]){logger[_0x0782('0xa')](_0x0782('0xb'),_0x590fca,_[_0x0782('0xc')](_0x900e3e,_0x0782('0xd'))[_0x0782('0xe')](',\x20'));logger[_0x0782('0xf')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x590fca);_0x1a87c3[_0x0782('0x10')]();}else{var _0x1cd48c=this;var _0xa85fdf=utils[_0x0782('0x11')](_0x3e99bc[0x0],this);logger[_0x0782('0xf')](_0x0782('0x12'),_0x590fca,_0xa85fdf);sh[_0x0782('0x13')](_[_0x0782('0x14')](_0xa85fdf),function(_0x52c7a7,_0x19575b){logger[_0x0782('0xf')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x590fca,_0x52c7a7);if(_0x52c7a7==0x0){var _0x26bbde=_0x19575b['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x0782('0x15')](_0x3e99bc[0x1])||_['isEmpty'](_0x3e99bc[0x1])){logger['info'](_0x0782('0x16'),_0x590fca);_0x1cd48c[_0x0782('0x17')][_0x3e99bc[0x1]]=_0x26bbde;}else{logger[_0x0782('0xf')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x590fca,_0x3e99bc[0x1],_0x26bbde);_0x1cd48c[_0x0782('0x17')][_0x3e99bc[0x1]]=_0x26bbde;}}_0x1a87c3[_0x0782('0x10')]();});}}catch(_0x85eb54){logger['error'](_0x0782('0xb'),_0x590fca,_['isObject'](_0x85eb54)?JSON[_0x0782('0x18')](_0x85eb54):_0x85eb54);logger[_0x0782('0xf')](_0x0782('0x19'),_0x590fca);_0x1a87c3['next']();}};};