Built motion from commit efa66e19.|2.6.22
[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 _0x7a82=['consequence','length','[%s][GOTOP]\x20%s','join','stop','priority','rules','info','next','error','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x48517e,_0x7b51a){var _0x40ff95=function(_0x14d8c6){while(--_0x14d8c6){_0x48517e['push'](_0x48517e['shift']());}};_0x40ff95(++_0x7b51a);}(_0x7a82,0x118));var _0x27a8=function(_0x53c5e2,_0x5cd401){_0x53c5e2=_0x53c5e2-0x0;var _0xfc6aaf=_0x7a82[_0x53c5e2];return _0xfc6aaf;};'use strict';var schema=require(_0x27a8('0x0'));var _=require(_0x27a8('0x1'));var logger=require('../../../../config/logger')(_0x27a8('0x2'));var gotop=schema({'priority':{'type':_0x27a8('0x3'),'required':!![],'message':_0x27a8('0x4')}});exports[_0x27a8('0x5')]=function(_0x2cdc68,_0x2e2be9){return function(_0x134883){try{var _0x53fcb4={'priority':_0x2e2be9[0x0]};var _0x1e4133=gotop[_0x27a8('0x0')](_0x53fcb4,{'typecast':!![]});if(_0x1e4133[_0x27a8('0x6')]){logger['error'](_0x27a8('0x7'),_0x2cdc68,_['map'](_0x1e4133,'message')[_0x27a8('0x8')](',\x20'));_0x134883[_0x27a8('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x2cdc68,_0x53fcb4[_0x27a8('0xa')]);if(_0x53fcb4['priority']){var _0x37cd97=_['findIndex'](_0x134883[_0x27a8('0xb')](),{'p':_0x53fcb4[_0x27a8('0xa')]});if(_0x37cd97>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2cdc68,_0x53fcb4[_0x27a8('0xa')]||'next',_0x37cd97);_0x134883['next'](_0x37cd97);}else{logger[_0x27a8('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x2cdc68,_0x53fcb4[_0x27a8('0xa')]||_0x27a8('0xd'));_0x134883[_0x27a8('0x9')]();}}else{_0x134883['next']();}}}catch(_0x19c534){logger[_0x27a8('0xe')](_0x27a8('0x7'),_0x2cdc68,JSON['stringify'](_0x19c534));_0x134883[_0x27a8('0x9')]();}};};