41f4d1ac803b67556522f1994f3e990b8c927b76
[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 _0xf2c9=['[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','trim'];(function(_0x270c4f,_0x45a4c9){var _0x33c664=function(_0x568ab4){while(--_0x568ab4){_0x270c4f['push'](_0x270c4f['shift']());}};_0x33c664(++_0x45a4c9);}(_0xf2c9,0x187));var _0x9f2c=function(_0x117994,_0x46bbbb){_0x117994=_0x117994-0x0;var _0x40814a=_0xf2c9[_0x117994];return _0x40814a;};'use strict';var schema=require(_0x9f2c('0x0'));var sh=require(_0x9f2c('0x1'));var _=require(_0x9f2c('0x2'));var utils=require(_0x9f2c('0x3'));var logger=require(_0x9f2c('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x9f2c('0x5')}});exports[_0x9f2c('0x6')]=function(_0xcffe9a,_0x44bccb){return function(_0x47b67f){try{var _0x49faa9={'command':_0x44bccb[0x0]};var _0x118d31=system['validate'](_0x49faa9,{'typecast':!![]});if(_0x118d31[_0x9f2c('0x7')]){logger['error'](_0x9f2c('0x8'),_0xcffe9a,_[_0x9f2c('0x9')](_0x118d31,_0x9f2c('0xa'))[_0x9f2c('0xb')](',\x20'));logger[_0x9f2c('0xc')](_0x9f2c('0xd'),_0xcffe9a);_0x47b67f[_0x9f2c('0xe')]();}else{var _0x55c20b=this;var _0x677381=utils['getMustacheRender'](_0x44bccb[0x0],this);logger['info'](_0x9f2c('0xf'),_0xcffe9a,_0x677381);sh['exec'](_[_0x9f2c('0x10')](_0x677381),function(_0xa52b97,_0x545719){logger['info'](_0x9f2c('0x11'),_0xcffe9a,_0xa52b97);if(_0xa52b97==0x0){var _0x2008dc=_0x545719['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x9f2c('0x12')](_0x44bccb[0x1])||_[_0x9f2c('0x13')](_0x44bccb[0x1])){logger[_0x9f2c('0xc')](_0x9f2c('0x14'),_0xcffe9a);_0x55c20b[_0x9f2c('0x15')][_0x44bccb[0x1]]=_0x2008dc;}else{logger['info'](_0x9f2c('0x16'),_0xcffe9a,_0x44bccb[0x1],_0x2008dc);_0x55c20b['body'][_0x44bccb[0x1]]=_0x2008dc;}}_0x47b67f[_0x9f2c('0xe')]();});}}catch(_0x32e746){logger['error'](_0x9f2c('0x8'),_0xcffe9a,_[_0x9f2c('0x17')](_0x32e746)?JSON['stringify'](_0x32e746):_0x32e746);logger[_0x9f2c('0xc')](_0x9f2c('0xd'),_0xcffe9a);_0x47b67f['next']();}};};