f22f7824970e048523976c1ea57b73ae4040877f
[motion2.git] / server / services / routing / server / applications / gotop.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 _0x89aa=['error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length'];(function(_0x42ba14,_0x231319){var _0x5475a6=function(_0x29db89){while(--_0x29db89){_0x42ba14['push'](_0x42ba14['shift']());}};_0x5475a6(++_0x231319);}(_0x89aa,0x92));var _0xa89a=function(_0x298235,_0xb46ba1){_0x298235=_0x298235-0x0;var _0x32824f=_0x89aa[_0x298235];return _0x32824f;};'use strict';var schema=require(_0xa89a('0x0'));var _=require(_0xa89a('0x1'));var logger=require(_0xa89a('0x2'))('routing');var gotop=schema({'priority':{'type':_0xa89a('0x3'),'required':!![],'message':_0xa89a('0x4')}});exports['consequence']=function(_0xe0564f,_0x41d328){return function(_0x3428f7){try{var _0x5eb9de={'priority':_0x41d328[0x0]};var _0x55a769=gotop[_0xa89a('0x0')](_0x5eb9de,{'typecast':!![]});if(_0x55a769[_0xa89a('0x5')]){logger[_0xa89a('0x6')](_0xa89a('0x7'),_0xe0564f,_['map'](_0x55a769,_0xa89a('0x8'))[_0xa89a('0x9')](',\x20'));_0x3428f7[_0xa89a('0xa')]();}else{logger[_0xa89a('0xb')](_0xa89a('0xc'),_0xe0564f,_0x5eb9de['priority']);if(_0x5eb9de[_0xa89a('0xd')]){var _0x5a00e8=_[_0xa89a('0xe')](_0x3428f7['rules'](),{'p':_0x5eb9de['priority']});if(_0x5a00e8>=0x0){logger['info'](_0xa89a('0xf'),_0xe0564f,_0x5eb9de[_0xa89a('0xd')]||_0xa89a('0x10'),_0x5a00e8);_0x3428f7[_0xa89a('0x10')](_0x5a00e8);}else{logger[_0xa89a('0xb')](_0xa89a('0x11'),_0xe0564f,_0x5eb9de[_0xa89a('0xd')]||'next');_0x3428f7['stop']();}}else{_0x3428f7[_0xa89a('0x10')]();}}}catch(_0x47aaf8){logger[_0xa89a('0x6')]('[%s][GOTOP]\x20%s',_0xe0564f,JSON[_0xa89a('0x12')](_0x47aaf8));_0x3428f7['stop']();}};};