Built motion from commit ffdca78c.|2.6.24
[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 _0x750d=['map','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0x4f1503,_0x3cf63a){var _0x2e6444=function(_0x3884e1){while(--_0x3884e1){_0x4f1503['push'](_0x4f1503['shift']());}};_0x2e6444(++_0x3cf63a);}(_0x750d,0xe3));var _0xd750=function(_0x58b96e,_0x12ea11){_0x58b96e=_0x58b96e-0x0;var _0x1f3909=_0x750d[_0x58b96e];return _0x1f3909;};'use strict';var schema=require('validate');var _=require(_0xd750('0x0'));var logger=require(_0xd750('0x1'))(_0xd750('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xd750('0x3')]=function(_0x15f759,_0x20909b){return function(_0xce6f52){try{var _0x479541={'priority':_0x20909b[0x0]};var _0x1e14ff=gotop['validate'](_0x479541,{'typecast':!![]});if(_0x1e14ff[_0xd750('0x4')]){logger[_0xd750('0x5')](_0xd750('0x6'),_0x15f759,_[_0xd750('0x7')](_0x1e14ff,'message')[_0xd750('0x8')](',\x20'));_0xce6f52[_0xd750('0x9')]();}else{logger['info'](_0xd750('0xa'),_0x15f759,_0x479541[_0xd750('0xb')]);if(_0x479541['priority']){var _0x57a7f1=_[_0xd750('0xc')](_0xce6f52[_0xd750('0xd')](),{'p':_0x479541[_0xd750('0xb')]});if(_0x57a7f1>=0x0){logger[_0xd750('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x15f759,_0x479541['priority']||_0xd750('0xf'),_0x57a7f1);_0xce6f52[_0xd750('0xf')](_0x57a7f1);}else{logger[_0xd750('0xe')](_0xd750('0x10'),_0x15f759,_0x479541['priority']||'next');_0xce6f52[_0xd750('0x9')]();}}else{_0xce6f52[_0xd750('0xf')]();}}}catch(_0x210e5f){logger[_0xd750('0x5')](_0xd750('0x6'),_0x15f759,JSON[_0xd750('0x11')](_0x210e5f));_0xce6f52[_0xd750('0x9')]();}};};