Built motion from commit (unavailable).|2.4.13
[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 _0xdae4=['length','error','[%s][GOTOP]\x20%s','map','message','join','stop','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x223199,_0x2d429f){var _0x5cfb8d=function(_0x4679e9){while(--_0x4679e9){_0x223199['push'](_0x223199['shift']());}};_0x5cfb8d(++_0x2d429f);}(_0xdae4,0x165));var _0x4dae=function(_0x2f0e60,_0x1496ae){_0x2f0e60=_0x2f0e60-0x0;var _0x168472=_0xdae4[_0x2f0e60];return _0x168472;};'use strict';var schema=require('validate');var _=require(_0x4dae('0x0'));var logger=require(_0x4dae('0x1'))('routing');var gotop=schema({'priority':{'type':_0x4dae('0x2'),'required':!![],'message':_0x4dae('0x3')}});exports['consequence']=function(_0x3c15f2,_0x297cde){return function(_0x586100){try{var _0xd19e5={'priority':_0x297cde[0x0]};var _0x2e3731=gotop['validate'](_0xd19e5,{'typecast':!![]});if(_0x2e3731[_0x4dae('0x4')]){logger[_0x4dae('0x5')](_0x4dae('0x6'),_0x3c15f2,_[_0x4dae('0x7')](_0x2e3731,_0x4dae('0x8'))[_0x4dae('0x9')](',\x20'));_0x586100[_0x4dae('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x3c15f2,_0xd19e5['priority']);if(_0xd19e5[_0x4dae('0xb')]){var _0x19dd8f=_[_0x4dae('0xc')](_0x586100[_0x4dae('0xd')](),{'p':_0xd19e5[_0x4dae('0xb')]});if(_0x19dd8f>=0x0){logger['info'](_0x4dae('0xe'),_0x3c15f2,_0xd19e5[_0x4dae('0xb')]||_0x4dae('0xf'),_0x19dd8f);_0x586100['next'](_0x19dd8f);}else{logger[_0x4dae('0x10')](_0x4dae('0x11'),_0x3c15f2,_0xd19e5[_0x4dae('0xb')]||_0x4dae('0xf'));_0x586100[_0x4dae('0xa')]();}}else{_0x586100[_0x4dae('0xf')]();}}}catch(_0x56c98c){logger['error'](_0x4dae('0x6'),_0x3c15f2,JSON[_0x4dae('0x12')](_0x56c98c));_0x586100['stop']();}};};