Built motion from commit (unavailable).|2.5.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 _0x3fef=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x3fef,0xdf));var _0xf3fe=function(_0x16f150,_0x58bd2f){_0x16f150=_0x16f150-0x0;var _0x5954cb=_0x3fef[_0x16f150];return _0x5954cb;};'use strict';var schema=require(_0xf3fe('0x0'));var _=require(_0xf3fe('0x1'));var logger=require(_0xf3fe('0x2'))('routing');var gotop=schema({'priority':{'type':_0xf3fe('0x3'),'required':!![],'message':_0xf3fe('0x4')}});exports['consequence']=function(_0x455c03,_0xc9fd){return function(_0x510cd4){try{var _0x28e883={'priority':_0xc9fd[0x0]};var _0x15c073=gotop['validate'](_0x28e883,{'typecast':!![]});if(_0x15c073[_0xf3fe('0x5')]){logger[_0xf3fe('0x6')](_0xf3fe('0x7'),_0x455c03,_['map'](_0x15c073,_0xf3fe('0x8'))[_0xf3fe('0x9')](',\x20'));_0x510cd4['stop']();}else{logger[_0xf3fe('0xa')](_0xf3fe('0xb'),_0x455c03,_0x28e883[_0xf3fe('0xc')]);if(_0x28e883['priority']){var _0x12443d=_[_0xf3fe('0xd')](_0x510cd4[_0xf3fe('0xe')](),{'p':_0x28e883[_0xf3fe('0xc')]});if(_0x12443d>=0x0){logger['info'](_0xf3fe('0xf'),_0x455c03,_0x28e883['priority']||_0xf3fe('0x10'),_0x12443d);_0x510cd4[_0xf3fe('0x10')](_0x12443d);}else{logger[_0xf3fe('0xa')](_0xf3fe('0x11'),_0x455c03,_0x28e883[_0xf3fe('0xc')]||_0xf3fe('0x10'));_0x510cd4[_0xf3fe('0x12')]();}}else{_0x510cd4['next']();}}}catch(_0x58af34){logger[_0xf3fe('0x6')](_0xf3fe('0x7'),_0x455c03,JSON[_0xf3fe('0x13')](_0x58af34));_0x510cd4[_0xf3fe('0x12')]();}};};