Built motion from commit b5996064.|2.6.21
[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 _0xd220=['validate','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xd220,0x1dc));var _0x0d22=function(_0x377c65,_0x22e152){_0x377c65=_0x377c65-0x0;var _0x24c5ca=_0xd220[_0x377c65];return _0x24c5ca;};'use strict';var schema=require(_0x0d22('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0x0d22('0x1'));var gotop=schema({'priority':{'type':_0x0d22('0x2'),'required':!![],'message':_0x0d22('0x3')}});exports[_0x0d22('0x4')]=function(_0x24a665,_0x505107){return function(_0xbcbc53){try{var _0x1a8613={'priority':_0x505107[0x0]};var _0x54f0e7=gotop[_0x0d22('0x0')](_0x1a8613,{'typecast':!![]});if(_0x54f0e7[_0x0d22('0x5')]){logger[_0x0d22('0x6')](_0x0d22('0x7'),_0x24a665,_['map'](_0x54f0e7,'message')[_0x0d22('0x8')](',\x20'));_0xbcbc53[_0x0d22('0x9')]();}else{logger['info'](_0x0d22('0xa'),_0x24a665,_0x1a8613[_0x0d22('0xb')]);if(_0x1a8613['priority']){var _0xcfacb1=_['findIndex'](_0xbcbc53[_0x0d22('0xc')](),{'p':_0x1a8613[_0x0d22('0xb')]});if(_0xcfacb1>=0x0){logger[_0x0d22('0xd')](_0x0d22('0xe'),_0x24a665,_0x1a8613['priority']||_0x0d22('0xf'),_0xcfacb1);_0xbcbc53[_0x0d22('0xf')](_0xcfacb1);}else{logger[_0x0d22('0xd')](_0x0d22('0x10'),_0x24a665,_0x1a8613[_0x0d22('0xb')]||'next');_0xbcbc53['stop']();}}else{_0xbcbc53[_0x0d22('0xf')]();}}}catch(_0x2c4af9){logger['error'](_0x0d22('0x7'),_0x24a665,JSON['stringify'](_0x2c4af9));_0xbcbc53[_0x0d22('0x9')]();}};};