73db97646fd67b53329ec121b4427bc124e8e558
[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 _0x79f9=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x1faec5,_0x4208cd){var _0x5851e5=function(_0x1f3ff8){while(--_0x1f3ff8){_0x1faec5['push'](_0x1faec5['shift']());}};_0x5851e5(++_0x4208cd);}(_0x79f9,0xbd));var _0x979f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x79f9[_0x57b54c];return _0x59cc19;};'use strict';var schema=require(_0x979f('0x0'));var sh=require(_0x979f('0x1'));var _=require(_0x979f('0x2'));var utils=require(_0x979f('0x3'));var logger=require(_0x979f('0x4'))(_0x979f('0x5'));var system=schema({'command':{'type':_0x979f('0x6'),'required':!![],'message':_0x979f('0x7')}});exports[_0x979f('0x8')]=function(_0x2ab8fe,_0x56913f){return function(_0xbcf116){try{var _0x192820={'command':_0x56913f[0x0]};var _0xc4e47=system['validate'](_0x192820,{'typecast':!![]});if(_0xc4e47[_0x979f('0x9')]){logger[_0x979f('0xa')](_0x979f('0xb'),_0x2ab8fe,_[_0x979f('0xc')](_0xc4e47,_0x979f('0xd'))[_0x979f('0xe')](',\x20'));logger['info'](_0x979f('0xf'),_0x2ab8fe);_0xbcf116['next']();}else{var _0x5d1815=this;var _0xdb2bfa=utils[_0x979f('0x10')](_0x56913f[0x0],this);logger[_0x979f('0x11')](_0x979f('0x12'),_0x2ab8fe,_0xdb2bfa);sh[_0x979f('0x13')](_['trim'](_0xdb2bfa),function(_0x310804,_0x44a586){logger[_0x979f('0x11')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2ab8fe,_0x310804);if(_0x310804==0x0){var _0x204c0f=_0x44a586[_0x979f('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x56913f[0x1])||_[_0x979f('0x15')](_0x56913f[0x1])){logger[_0x979f('0x11')](_0x979f('0x16'),_0x2ab8fe);_0x5d1815['body'][_0x56913f[0x1]]=_0x204c0f;}else{logger[_0x979f('0x11')](_0x979f('0x17'),_0x2ab8fe,_0x56913f[0x1],_0x204c0f);_0x5d1815[_0x979f('0x18')][_0x56913f[0x1]]=_0x204c0f;}}_0xbcf116[_0x979f('0x19')]();});}}catch(_0x2de146){logger[_0x979f('0xa')](_0x979f('0xb'),_0x2ab8fe,_[_0x979f('0x1a')](_0x2de146)?JSON[_0x979f('0x1b')](_0x2de146):_0x2de146);logger['info'](_0x979f('0xf'),_0x2ab8fe);_0xbcf116[_0x979f('0x19')]();}};};