Built motion from commit 9d0783e6.|2.6.13
[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 _0x5eff=['length','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','stringify','validate','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x3f73b2,_0x57c771){var _0x202dd8=function(_0x57e329){while(--_0x57e329){_0x3f73b2['push'](_0x3f73b2['shift']());}};_0x202dd8(++_0x57c771);}(_0x5eff,0x76));var _0xf5ef=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x5eff[_0x5d2803];return _0xdcad2c;};'use strict';var schema=require(_0xf5ef('0x0'));var sh=require(_0xf5ef('0x1'));var _=require(_0xf5ef('0x2'));var utils=require('./utils');var logger=require(_0xf5ef('0x3'))(_0xf5ef('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xf5ef('0x5')}});exports[_0xf5ef('0x6')]=function(_0x490a6e,_0x55f3c6){return function(_0x38e14a){try{var _0x1fdbc9={'command':_0x55f3c6[0x0]};var _0x5def2a=system[_0xf5ef('0x0')](_0x1fdbc9,{'typecast':!![]});if(_0x5def2a[_0xf5ef('0x7')]){logger['error'](_0xf5ef('0x8'),_0x490a6e,_['map'](_0x5def2a,_0xf5ef('0x9'))['join'](',\x20'));logger[_0xf5ef('0xa')](_0xf5ef('0xb'),_0x490a6e);_0x38e14a[_0xf5ef('0xc')]();}else{var _0x171e66=this;var _0x263a40=utils[_0xf5ef('0xd')](_0x55f3c6[0x0],this);logger[_0xf5ef('0xa')](_0xf5ef('0xe'),_0x490a6e,_0x263a40);sh[_0xf5ef('0xf')](_['trim'](_0x263a40),function(_0x59dd07,_0x5ce9d1){logger['info'](_0xf5ef('0x10'),_0x490a6e,_0x59dd07);if(_0x59dd07==0x0){var _0x1a7f04=_0x5ce9d1[_0xf5ef('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xf5ef('0x12')](_0x55f3c6[0x1])||_[_0xf5ef('0x13')](_0x55f3c6[0x1])){logger['info'](_0xf5ef('0x14'),_0x490a6e);_0x171e66[_0xf5ef('0x15')][_0x55f3c6[0x1]]=_0x1a7f04;}else{logger[_0xf5ef('0xa')](_0xf5ef('0x16'),_0x490a6e,_0x55f3c6[0x1],_0x1a7f04);_0x171e66[_0xf5ef('0x15')][_0x55f3c6[0x1]]=_0x1a7f04;}}_0x38e14a[_0xf5ef('0xc')]();});}}catch(_0x1161e6){logger[_0xf5ef('0x17')]('[%s][SYSTEM]\x20%s',_0x490a6e,_['isObject'](_0x1161e6)?JSON[_0xf5ef('0x18')](_0x1161e6):_0x1161e6);logger[_0xf5ef('0xa')](_0xf5ef('0xb'),_0x490a6e);_0x38e14a[_0xf5ef('0xc')]();}};};