Built motion from commit f8768ebe.|2.6.15
[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 _0x7498=['../../../../config/logger','routing','number','length','error','[%s][GOTOP]\x20%s','map','message','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash'];(function(_0xc036bb,_0x5cab81){var _0x523ab9=function(_0x2eed72){while(--_0x2eed72){_0xc036bb['push'](_0xc036bb['shift']());}};_0x523ab9(++_0x5cab81);}(_0x7498,0x17a));var _0x8749=function(_0x5d2bf3,_0x33082f){_0x5d2bf3=_0x5d2bf3-0x0;var _0x3af7ad=_0x7498[_0x5d2bf3];return _0x3af7ad;};'use strict';var schema=require(_0x8749('0x0'));var _=require(_0x8749('0x1'));var logger=require(_0x8749('0x2'))(_0x8749('0x3'));var gotop=schema({'priority':{'type':_0x8749('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x17472f,_0x485c55){return function(_0x4cb118){try{var _0x5d0e81={'priority':_0x485c55[0x0]};var _0x378d2c=gotop['validate'](_0x5d0e81,{'typecast':!![]});if(_0x378d2c[_0x8749('0x5')]){logger[_0x8749('0x6')](_0x8749('0x7'),_0x17472f,_[_0x8749('0x8')](_0x378d2c,_0x8749('0x9'))[_0x8749('0xa')](',\x20'));_0x4cb118['stop']();}else{logger['info'](_0x8749('0xb'),_0x17472f,_0x5d0e81[_0x8749('0xc')]);if(_0x5d0e81['priority']){var _0x3cc039=_[_0x8749('0xd')](_0x4cb118[_0x8749('0xe')](),{'p':_0x5d0e81[_0x8749('0xc')]});if(_0x3cc039>=0x0){logger[_0x8749('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x17472f,_0x5d0e81[_0x8749('0xc')]||_0x8749('0x10'),_0x3cc039);_0x4cb118['next'](_0x3cc039);}else{logger[_0x8749('0xf')](_0x8749('0x11'),_0x17472f,_0x5d0e81[_0x8749('0xc')]||_0x8749('0x10'));_0x4cb118[_0x8749('0x12')]();}}else{_0x4cb118[_0x8749('0x10')]();}}}catch(_0x418193){logger[_0x8749('0x6')]('[%s][GOTOP]\x20%s',_0x17472f,JSON[_0x8749('0x13')](_0x418193));_0x4cb118[_0x8749('0x12')]();}};};