e0ba9281bbbf143d85724f66bf5faa9751be5623
[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 _0xf09b=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop'];(function(_0x2be6e6,_0x1b63d2){var _0x276550=function(_0x530250){while(--_0x530250){_0x2be6e6['push'](_0x2be6e6['shift']());}};_0x276550(++_0x1b63d2);}(_0xf09b,0x70));var _0xbf09=function(_0x54412a,_0x4962b0){_0x54412a=_0x54412a-0x0;var _0xc409b5=_0xf09b[_0x54412a];return _0xc409b5;};'use strict';var schema=require(_0xbf09('0x0'));var _=require(_0xbf09('0x1'));var logger=require(_0xbf09('0x2'))(_0xbf09('0x3'));var gotop=schema({'priority':{'type':_0xbf09('0x4'),'required':!![],'message':_0xbf09('0x5')}});exports[_0xbf09('0x6')]=function(_0xbad568,_0x11a9cc){return function(_0x1573cb){try{var _0x8439ce={'priority':_0x11a9cc[0x0]};var _0x54969f=gotop[_0xbf09('0x0')](_0x8439ce,{'typecast':!![]});if(_0x54969f[_0xbf09('0x7')]){logger[_0xbf09('0x8')](_0xbf09('0x9'),_0xbad568,_[_0xbf09('0xa')](_0x54969f,_0xbf09('0xb'))[_0xbf09('0xc')](',\x20'));_0x1573cb[_0xbf09('0xd')]();}else{logger['info'](_0xbf09('0xe'),_0xbad568,_0x8439ce[_0xbf09('0xf')]);if(_0x8439ce['priority']){var _0x783827=_[_0xbf09('0x10')](_0x1573cb['rules'](),{'p':_0x8439ce[_0xbf09('0xf')]});if(_0x783827>=0x0){logger['info'](_0xbf09('0x11'),_0xbad568,_0x8439ce[_0xbf09('0xf')]||'next',_0x783827);_0x1573cb[_0xbf09('0x12')](_0x783827);}else{logger[_0xbf09('0x13')](_0xbf09('0x14'),_0xbad568,_0x8439ce['priority']||_0xbf09('0x12'));_0x1573cb[_0xbf09('0xd')]();}}else{_0x1573cb['next']();}}}catch(_0xe77263){logger['error']('[%s][GOTOP]\x20%s',_0xbad568,JSON['stringify'](_0xe77263));_0x1573cb[_0xbf09('0xd')]();}};};