45f952ac2f185d7d5ddec834aab1713d943f75b3
[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 _0x7e25=['next','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules'];(function(_0x40c5f1,_0x11f611){var _0x32c500=function(_0x3679d8){while(--_0x3679d8){_0x40c5f1['push'](_0x40c5f1['shift']());}};_0x32c500(++_0x11f611);}(_0x7e25,0x158));var _0x57e2=function(_0xdf1858,_0x5692d0){_0xdf1858=_0xdf1858-0x0;var _0x3e64f0=_0x7e25[_0xdf1858];return _0x3e64f0;};'use strict';var schema=require(_0x57e2('0x0'));var _=require('lodash');var logger=require(_0x57e2('0x1'))(_0x57e2('0x2'));var gotop=schema({'priority':{'type':_0x57e2('0x3'),'required':!![],'message':_0x57e2('0x4')}});exports[_0x57e2('0x5')]=function(_0x148bbc,_0x2a4c93){return function(_0x1fb160){try{var _0x23c4bb={'priority':_0x2a4c93[0x0]};var _0x28c361=gotop[_0x57e2('0x0')](_0x23c4bb,{'typecast':!![]});if(_0x28c361[_0x57e2('0x6')]){logger[_0x57e2('0x7')](_0x57e2('0x8'),_0x148bbc,_['map'](_0x28c361,_0x57e2('0x9'))[_0x57e2('0xa')](',\x20'));_0x1fb160[_0x57e2('0xb')]();}else{logger[_0x57e2('0xc')](_0x57e2('0xd'),_0x148bbc,_0x23c4bb['priority']);if(_0x23c4bb[_0x57e2('0xe')]){var _0x111b47=_[_0x57e2('0xf')](_0x1fb160[_0x57e2('0x10')](),{'p':_0x23c4bb[_0x57e2('0xe')]});if(_0x111b47>=0x0){logger[_0x57e2('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x148bbc,_0x23c4bb['priority']||'next',_0x111b47);_0x1fb160[_0x57e2('0x11')](_0x111b47);}else{logger[_0x57e2('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x148bbc,_0x23c4bb[_0x57e2('0xe')]||_0x57e2('0x11'));_0x1fb160[_0x57e2('0xb')]();}}else{_0x1fb160['next']();}}}catch(_0x44e806){logger[_0x57e2('0x7')](_0x57e2('0x8'),_0x148bbc,JSON[_0x57e2('0x12')](_0x44e806));_0x1fb160[_0x57e2('0xb')]();}};};