86f116de5c1922cc7fc8d4a5b14598a219f3593f
[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 _0x0912=['../../../../config/logger','routing','number','consequence','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash'];(function(_0x9842c1,_0x1edf79){var _0x5ba376=function(_0x4b88ed){while(--_0x4b88ed){_0x9842c1['push'](_0x9842c1['shift']());}};_0x5ba376(++_0x1edf79);}(_0x0912,0x11c));var _0x2091=function(_0x591448,_0x443a02){_0x591448=_0x591448-0x0;var _0x22da37=_0x0912[_0x591448];return _0x22da37;};'use strict';var schema=require('validate');var _=require(_0x2091('0x0'));var logger=require(_0x2091('0x1'))(_0x2091('0x2'));var gotop=schema({'priority':{'type':_0x2091('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x2091('0x4')]=function(_0x2e15d9,_0x33f9df){return function(_0x4ba5d2){try{var _0x329407={'priority':_0x33f9df[0x0]};var _0x1bb10d=gotop['validate'](_0x329407,{'typecast':!![]});if(_0x1bb10d['length']){logger[_0x2091('0x5')](_0x2091('0x6'),_0x2e15d9,_[_0x2091('0x7')](_0x1bb10d,_0x2091('0x8'))['join'](',\x20'));_0x4ba5d2[_0x2091('0x9')]();}else{logger[_0x2091('0xa')](_0x2091('0xb'),_0x2e15d9,_0x329407[_0x2091('0xc')]);if(_0x329407[_0x2091('0xc')]){var _0x396422=_[_0x2091('0xd')](_0x4ba5d2[_0x2091('0xe')](),{'p':_0x329407['priority']});if(_0x396422>=0x0){logger[_0x2091('0xa')](_0x2091('0xf'),_0x2e15d9,_0x329407[_0x2091('0xc')]||_0x2091('0x10'),_0x396422);_0x4ba5d2[_0x2091('0x10')](_0x396422);}else{logger[_0x2091('0xa')](_0x2091('0x11'),_0x2e15d9,_0x329407[_0x2091('0xc')]||_0x2091('0x10'));_0x4ba5d2['stop']();}}else{_0x4ba5d2['next']();}}}catch(_0x3cffda){logger[_0x2091('0x5')](_0x2091('0x6'),_0x2e15d9,JSON[_0x2091('0x12')](_0x3cffda));_0x4ba5d2['stop']();}};};