Built motion from commit (unavailable).|2.5.14
[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 _0x05a4=['stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x299028,_0x4d7e9f){var _0x12154e=function(_0x558d18){while(--_0x558d18){_0x299028['push'](_0x299028['shift']());}};_0x12154e(++_0x4d7e9f);}(_0x05a4,0x199));var _0x405a=function(_0x1f93b2,_0xac1aa){_0x1f93b2=_0x1f93b2-0x0;var _0xaeab8c=_0x05a4[_0x1f93b2];return _0xaeab8c;};'use strict';var schema=require(_0x405a('0x0'));var _=require(_0x405a('0x1'));var logger=require('../../../../config/logger')(_0x405a('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x405a('0x3')}});exports[_0x405a('0x4')]=function(_0x52c47e,_0x25ffcf){return function(_0x1a4945){try{var _0x531fd0={'priority':_0x25ffcf[0x0]};var _0x4d7310=gotop[_0x405a('0x0')](_0x531fd0,{'typecast':!![]});if(_0x4d7310['length']){logger['error'](_0x405a('0x5'),_0x52c47e,_[_0x405a('0x6')](_0x4d7310,_0x405a('0x7'))[_0x405a('0x8')](',\x20'));_0x1a4945[_0x405a('0x9')]();}else{logger['info'](_0x405a('0xa'),_0x52c47e,_0x531fd0[_0x405a('0xb')]);if(_0x531fd0[_0x405a('0xb')]){var _0x33cbac=_[_0x405a('0xc')](_0x1a4945[_0x405a('0xd')](),{'p':_0x531fd0['priority']});if(_0x33cbac>=0x0){logger[_0x405a('0xe')](_0x405a('0xf'),_0x52c47e,_0x531fd0[_0x405a('0xb')]||'next',_0x33cbac);_0x1a4945[_0x405a('0x10')](_0x33cbac);}else{logger[_0x405a('0xe')](_0x405a('0x11'),_0x52c47e,_0x531fd0[_0x405a('0xb')]||_0x405a('0x10'));_0x1a4945[_0x405a('0x9')]();}}else{_0x1a4945[_0x405a('0x10')]();}}}catch(_0x70e832){logger['error']('[%s][GOTOP]\x20%s',_0x52c47e,JSON[_0x405a('0x12')](_0x70e832));_0x1a4945[_0x405a('0x9')]();}};};