Built motion from commit e6806ed6.|2.6.0
[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 _0x8e25=['findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','../../../../config/logger','routing','number','consequence','validate','error','[%s][GOTOP]\x20%s','map','join','stop','info','priority'];(function(_0xe6e229,_0x4c51b9){var _0x4466b0=function(_0x1c1df6){while(--_0x1c1df6){_0xe6e229['push'](_0xe6e229['shift']());}};_0x4466b0(++_0x4c51b9);}(_0x8e25,0x1b4));var _0x58e2=function(_0x95675b,_0x88d868){_0x95675b=_0x95675b-0x0;var _0x2279e0=_0x8e25[_0x95675b];return _0x2279e0;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0x58e2('0x0'))(_0x58e2('0x1'));var gotop=schema({'priority':{'type':_0x58e2('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x58e2('0x3')]=function(_0x17b3f2,_0x1063fc){return function(_0x27497f){try{var _0x427f6f={'priority':_0x1063fc[0x0]};var _0x14d09b=gotop[_0x58e2('0x4')](_0x427f6f,{'typecast':!![]});if(_0x14d09b['length']){logger[_0x58e2('0x5')](_0x58e2('0x6'),_0x17b3f2,_[_0x58e2('0x7')](_0x14d09b,'message')[_0x58e2('0x8')](',\x20'));_0x27497f[_0x58e2('0x9')]();}else{logger[_0x58e2('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x17b3f2,_0x427f6f[_0x58e2('0xb')]);if(_0x427f6f[_0x58e2('0xb')]){var _0x8df45a=_[_0x58e2('0xc')](_0x27497f[_0x58e2('0xd')](),{'p':_0x427f6f[_0x58e2('0xb')]});if(_0x8df45a>=0x0){logger[_0x58e2('0xa')](_0x58e2('0xe'),_0x17b3f2,_0x427f6f[_0x58e2('0xb')]||_0x58e2('0xf'),_0x8df45a);_0x27497f[_0x58e2('0xf')](_0x8df45a);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x17b3f2,_0x427f6f[_0x58e2('0xb')]||_0x58e2('0xf'));_0x27497f[_0x58e2('0x9')]();}}else{_0x27497f[_0x58e2('0xf')]();}}}catch(_0x5c2056){logger['error']('[%s][GOTOP]\x20%s',_0x17b3f2,JSON['stringify'](_0x5c2056));_0x27497f[_0x58e2('0x9')]();}};};