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 _0xdb7d=['[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error'];(function(_0x4d81b4,_0xaf4f9b){var _0x2e2fe0=function(_0x1e3322){while(--_0x1e3322){_0x4d81b4['push'](_0x4d81b4['shift']());}};_0x2e2fe0(++_0xaf4f9b);}(_0xdb7d,0x174));var _0xddb7=function(_0x51aae2,_0x24124d){_0x51aae2=_0x51aae2-0x0;var _0x3532de=_0xdb7d[_0x51aae2];return _0x3532de;};'use strict';var schema=require('validate');var _=require(_0xddb7('0x0'));var logger=require(_0xddb7('0x1'))(_0xddb7('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xddb7('0x3')}});exports[_0xddb7('0x4')]=function(_0x10828b,_0x3ebe38){return function(_0x20ced4){try{var _0x11a516={'priority':_0x3ebe38[0x0]};var _0x198830=gotop[_0xddb7('0x5')](_0x11a516,{'typecast':!![]});if(_0x198830[_0xddb7('0x6')]){logger[_0xddb7('0x7')](_0xddb7('0x8'),_0x10828b,_[_0xddb7('0x9')](_0x198830,_0xddb7('0xa'))[_0xddb7('0xb')](',\x20'));_0x20ced4[_0xddb7('0xc')]();}else{logger[_0xddb7('0xd')](_0xddb7('0xe'),_0x10828b,_0x11a516['priority']);if(_0x11a516[_0xddb7('0xf')]){var _0x137906=_['findIndex'](_0x20ced4[_0xddb7('0x10')](),{'p':_0x11a516['priority']});if(_0x137906>=0x0){logger['info'](_0xddb7('0x11'),_0x10828b,_0x11a516['priority']||'next',_0x137906);_0x20ced4[_0xddb7('0x12')](_0x137906);}else{logger[_0xddb7('0xd')](_0xddb7('0x13'),_0x10828b,_0x11a516['priority']||_0xddb7('0x12'));_0x20ced4['stop']();}}else{_0x20ced4[_0xddb7('0x12')]();}}}catch(_0xe06e09){logger['error'](_0xddb7('0x8'),_0x10828b,JSON['stringify'](_0xe06e09));_0x20ced4['stop']();}};};