Built motion from commit (unavailable).|2.5.4
[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 _0x119e=['join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','routing','consequence','length','error','[%s][GOTOP]\x20%s','map','message'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x119e,0x108));var _0xe119=function(_0x10a736,_0x1f294a){_0x10a736=_0x10a736-0x0;var _0x2d1c83=_0x119e[_0x10a736];return _0x2d1c83;};'use strict';var schema=require('validate');var _=require(_0xe119('0x0'));var logger=require('../../../../config/logger')(_0xe119('0x1'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xe119('0x2')]=function(_0x2c7e4d,_0x26c5ff){return function(_0x174e31){try{var _0x1a7530={'priority':_0x26c5ff[0x0]};var _0x5de87e=gotop['validate'](_0x1a7530,{'typecast':!![]});if(_0x5de87e[_0xe119('0x3')]){logger[_0xe119('0x4')](_0xe119('0x5'),_0x2c7e4d,_[_0xe119('0x6')](_0x5de87e,_0xe119('0x7'))[_0xe119('0x8')](',\x20'));_0x174e31[_0xe119('0x9')]();}else{logger[_0xe119('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x2c7e4d,_0x1a7530[_0xe119('0xb')]);if(_0x1a7530['priority']){var _0x4e8bfe=_[_0xe119('0xc')](_0x174e31['rules'](),{'p':_0x1a7530[_0xe119('0xb')]});if(_0x4e8bfe>=0x0){logger['info'](_0xe119('0xd'),_0x2c7e4d,_0x1a7530['priority']||'next',_0x4e8bfe);_0x174e31[_0xe119('0xe')](_0x4e8bfe);}else{logger[_0xe119('0xa')](_0xe119('0xf'),_0x2c7e4d,_0x1a7530[_0xe119('0xb')]||_0xe119('0xe'));_0x174e31[_0xe119('0x9')]();}}else{_0x174e31[_0xe119('0xe')]();}}}catch(_0x4e16f3){logger[_0xe119('0x4')](_0xe119('0x5'),_0x2c7e4d,JSON[_0xe119('0x10')](_0x4e16f3));_0x174e31['stop']();}};};