ebe59ef30820bbbc478bb42a663ea235ca7a56df
[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 _0xe444=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number'];(function(_0x41070e,_0x473b04){var _0x1eb904=function(_0x2dca46){while(--_0x2dca46){_0x41070e['push'](_0x41070e['shift']());}};_0x1eb904(++_0x473b04);}(_0xe444,0x9d));var _0x4e44=function(_0x1846ea,_0x4b1d23){_0x1846ea=_0x1846ea-0x0;var _0x2de021=_0xe444[_0x1846ea];return _0x2de021;};'use strict';var schema=require(_0x4e44('0x0'));var _=require(_0x4e44('0x1'));var logger=require(_0x4e44('0x2'))(_0x4e44('0x3'));var gotop=schema({'priority':{'type':_0x4e44('0x4'),'required':!![],'message':_0x4e44('0x5')}});exports['consequence']=function(_0x5ed9eb,_0x1771d0){return function(_0x590bf7){try{var _0x263320={'priority':_0x1771d0[0x0]};var _0x554476=gotop[_0x4e44('0x0')](_0x263320,{'typecast':!![]});if(_0x554476[_0x4e44('0x6')]){logger[_0x4e44('0x7')](_0x4e44('0x8'),_0x5ed9eb,_['map'](_0x554476,'message')['join'](',\x20'));_0x590bf7[_0x4e44('0x9')]();}else{logger[_0x4e44('0xa')](_0x4e44('0xb'),_0x5ed9eb,_0x263320['priority']);if(_0x263320['priority']){var _0xa03453=_[_0x4e44('0xc')](_0x590bf7[_0x4e44('0xd')](),{'p':_0x263320[_0x4e44('0xe')]});if(_0xa03453>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5ed9eb,_0x263320[_0x4e44('0xe')]||_0x4e44('0xf'),_0xa03453);_0x590bf7[_0x4e44('0xf')](_0xa03453);}else{logger[_0x4e44('0xa')](_0x4e44('0x10'),_0x5ed9eb,_0x263320[_0x4e44('0xe')]||_0x4e44('0xf'));_0x590bf7['stop']();}}else{_0x590bf7['next']();}}}catch(_0x36b36b){logger[_0x4e44('0x7')]('[%s][GOTOP]\x20%s',_0x5ed9eb,JSON[_0x4e44('0x11')](_0x36b36b));_0x590bf7['stop']();}};};