25bb65a6e6e4f78093b814c51525d855f06115bf
[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 _0xeb37=['./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate'];(function(_0x30b520,_0x5133ae){var _0x5f4625=function(_0x21d2f5){while(--_0x21d2f5){_0x30b520['push'](_0x30b520['shift']());}};_0x5f4625(++_0x5133ae);}(_0xeb37,0x8f));var _0x7eb3=function(_0x4c07ff,_0xfd7b6e){_0x4c07ff=_0x4c07ff-0x0;var _0x9c7647=_0xeb37[_0x4c07ff];return _0x9c7647;};'use strict';var schema=require(_0x7eb3('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x7eb3('0x1'));var logger=require('../../../../config/logger')(_0x7eb3('0x2'));var system=schema({'command':{'type':_0x7eb3('0x3'),'required':!![],'message':_0x7eb3('0x4')}});exports['consequence']=function(_0x581fff,_0x183103){return function(_0x241830){try{var _0x16a55e={'command':_0x183103[0x0]};var _0x1bdca1=system[_0x7eb3('0x0')](_0x16a55e,{'typecast':!![]});if(_0x1bdca1[_0x7eb3('0x5')]){logger[_0x7eb3('0x6')](_0x7eb3('0x7'),_0x581fff,_['map'](_0x1bdca1,_0x7eb3('0x8'))[_0x7eb3('0x9')](',\x20'));logger[_0x7eb3('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x581fff);_0x241830[_0x7eb3('0xb')]();}else{var _0xf90bc0=this;var _0x5d1125=utils[_0x7eb3('0xc')](_0x183103[0x0],this);logger[_0x7eb3('0xa')](_0x7eb3('0xd'),_0x581fff,_0x5d1125);sh[_0x7eb3('0xe')](_[_0x7eb3('0xf')](_0x5d1125),function(_0x4565be,_0x1b9c4d){logger[_0x7eb3('0xa')](_0x7eb3('0x10'),_0x581fff,_0x4565be);if(_0x4565be==0x0){var _0xc75720=_0x1b9c4d[_0x7eb3('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x7eb3('0x12')](_0x183103[0x1])||_['isEmpty'](_0x183103[0x1])){logger[_0x7eb3('0xa')](_0x7eb3('0x13'),_0x581fff);_0xf90bc0[_0x7eb3('0x14')][_0x183103[0x1]]=_0xc75720;}else{logger[_0x7eb3('0xa')](_0x7eb3('0x15'),_0x581fff,_0x183103[0x1],_0xc75720);_0xf90bc0[_0x7eb3('0x14')][_0x183103[0x1]]=_0xc75720;}}_0x241830[_0x7eb3('0xb')]();});}}catch(_0x79ba87){logger[_0x7eb3('0x6')](_0x7eb3('0x7'),_0x581fff,_[_0x7eb3('0x16')](_0x79ba87)?JSON['stringify'](_0x79ba87):_0x79ba87);logger[_0x7eb3('0xa')](_0x7eb3('0x17'),_0x581fff);_0x241830['next']();}};};