Built motion from commit fe909640.|2.6.8
[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 _0xe62b=['lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate'];(function(_0x3a1198,_0xd6dec3){var _0x451a90=function(_0x1eb36c){while(--_0x1eb36c){_0x3a1198['push'](_0x3a1198['shift']());}};_0x451a90(++_0xd6dec3);}(_0xe62b,0x14f));var _0xbe62=function(_0x17eb11,_0x25d8c6){_0x17eb11=_0x17eb11-0x0;var _0x559093=_0xe62b[_0x17eb11];return _0x559093;};'use strict';var schema=require(_0xbe62('0x0'));var _=require(_0xbe62('0x1'));var logger=require(_0xbe62('0x2'))(_0xbe62('0x3'));var gotop=schema({'priority':{'type':_0xbe62('0x4'),'required':!![],'message':_0xbe62('0x5')}});exports['consequence']=function(_0x421ca4,_0x2ad317){return function(_0x199fff){try{var _0x2e0896={'priority':_0x2ad317[0x0]};var _0x1ad7d0=gotop['validate'](_0x2e0896,{'typecast':!![]});if(_0x1ad7d0[_0xbe62('0x6')]){logger[_0xbe62('0x7')](_0xbe62('0x8'),_0x421ca4,_[_0xbe62('0x9')](_0x1ad7d0,'message')[_0xbe62('0xa')](',\x20'));_0x199fff['stop']();}else{logger[_0xbe62('0xb')](_0xbe62('0xc'),_0x421ca4,_0x2e0896[_0xbe62('0xd')]);if(_0x2e0896['priority']){var _0x131f04=_[_0xbe62('0xe')](_0x199fff[_0xbe62('0xf')](),{'p':_0x2e0896[_0xbe62('0xd')]});if(_0x131f04>=0x0){logger[_0xbe62('0xb')](_0xbe62('0x10'),_0x421ca4,_0x2e0896[_0xbe62('0xd')]||_0xbe62('0x11'),_0x131f04);_0x199fff['next'](_0x131f04);}else{logger['info'](_0xbe62('0x12'),_0x421ca4,_0x2e0896[_0xbe62('0xd')]||'next');_0x199fff[_0xbe62('0x13')]();}}else{_0x199fff[_0xbe62('0x11')]();}}}catch(_0x307986){logger[_0xbe62('0x7')](_0xbe62('0x8'),_0x421ca4,JSON[_0xbe62('0x14')](_0x307986));_0x199fff[_0xbe62('0x13')]();}};};