5d0820c71de565b76f3c7a57d4042495f1fea108
[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 _0xb99f=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','join','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing'];(function(_0x8d562a,_0x484acf){var _0x2c59df=function(_0x40cd73){while(--_0x40cd73){_0x8d562a['push'](_0x8d562a['shift']());}};_0x2c59df(++_0x484acf);}(_0xb99f,0x12c));var _0xfb99=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xb99f[_0x67f95e];return _0x538f5a;};'use strict';var schema=require(_0xfb99('0x0'));var _=require(_0xfb99('0x1'));var logger=require(_0xfb99('0x2'))(_0xfb99('0x3'));var gotop=schema({'priority':{'type':_0xfb99('0x4'),'required':!![],'message':_0xfb99('0x5')}});exports[_0xfb99('0x6')]=function(_0x1e0009,_0x202811){return function(_0x509863){try{var _0x25840f={'priority':_0x202811[0x0]};var _0x33136b=gotop['validate'](_0x25840f,{'typecast':!![]});if(_0x33136b['length']){logger[_0xfb99('0x7')](_0xfb99('0x8'),_0x1e0009,_['map'](_0x33136b,'message')[_0xfb99('0x9')](',\x20'));_0x509863[_0xfb99('0xa')]();}else{logger[_0xfb99('0xb')](_0xfb99('0xc'),_0x1e0009,_0x25840f['priority']);if(_0x25840f['priority']){var _0x38f30f=_[_0xfb99('0xd')](_0x509863[_0xfb99('0xe')](),{'p':_0x25840f[_0xfb99('0xf')]});if(_0x38f30f>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1e0009,_0x25840f[_0xfb99('0xf')]||'next',_0x38f30f);_0x509863[_0xfb99('0x10')](_0x38f30f);}else{logger[_0xfb99('0xb')](_0xfb99('0x11'),_0x1e0009,_0x25840f[_0xfb99('0xf')]||_0xfb99('0x10'));_0x509863['stop']();}}else{_0x509863['next']();}}}catch(_0x17ab4b){logger[_0xfb99('0x7')](_0xfb99('0x8'),_0x1e0009,JSON[_0xfb99('0x12')](_0x17ab4b));_0x509863['stop']();}};};