9631bf94fdcf8e9804847b0b3c31a5be352d9e14
[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 _0xd11c=['../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','next','error','stringify','lodash'];(function(_0x4cae4e,_0x286828){var _0x1052f4=function(_0x5bf422){while(--_0x5bf422){_0x4cae4e['push'](_0x4cae4e['shift']());}};_0x1052f4(++_0x286828);}(_0xd11c,0x13f));var _0xcd11=function(_0x53ce77,_0x485779){_0x53ce77=_0x53ce77-0x0;var _0x2a373f=_0xd11c[_0x53ce77];return _0x2a373f;};'use strict';var schema=require('validate');var _=require(_0xcd11('0x0'));var logger=require(_0xcd11('0x1'))(_0xcd11('0x2'));var gotop=schema({'priority':{'type':_0xcd11('0x3'),'required':!![],'message':_0xcd11('0x4')}});exports[_0xcd11('0x5')]=function(_0x46beda,_0x2e0fb2){return function(_0x124116){try{var _0x3c9ff9={'priority':_0x2e0fb2[0x0]};var _0x1c3dec=gotop[_0xcd11('0x6')](_0x3c9ff9,{'typecast':!![]});if(_0x1c3dec['length']){logger['error'](_0xcd11('0x7'),_0x46beda,_[_0xcd11('0x8')](_0x1c3dec,_0xcd11('0x9'))[_0xcd11('0xa')](',\x20'));_0x124116[_0xcd11('0xb')]();}else{logger['info'](_0xcd11('0xc'),_0x46beda,_0x3c9ff9[_0xcd11('0xd')]);if(_0x3c9ff9[_0xcd11('0xd')]){var _0x5ba2a2=_[_0xcd11('0xe')](_0x124116[_0xcd11('0xf')](),{'p':_0x3c9ff9['priority']});if(_0x5ba2a2>=0x0){logger[_0xcd11('0x10')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x46beda,_0x3c9ff9[_0xcd11('0xd')]||'next',_0x5ba2a2);_0x124116[_0xcd11('0x11')](_0x5ba2a2);}else{logger[_0xcd11('0x10')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x46beda,_0x3c9ff9['priority']||_0xcd11('0x11'));_0x124116['stop']();}}else{_0x124116[_0xcd11('0x11')]();}}}catch(_0x309ba6){logger[_0xcd11('0x12')]('[%s][GOTOP]\x20%s',_0x46beda,JSON[_0xcd11('0x13')](_0x309ba6));_0x124116['stop']();}};};