Built motion from commit f0b1811d.|2.6.6
[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 _0x438e=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','routing'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x438e,0x10d));var _0xe438=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0x438e[_0x5ebf44];return _0x2fef12;};'use strict';var schema=require(_0xe438('0x0'));var _=require(_0xe438('0x1'));var logger=require(_0xe438('0x2'))(_0xe438('0x3'));var gotop=schema({'priority':{'type':_0xe438('0x4'),'required':!![],'message':_0xe438('0x5')}});exports[_0xe438('0x6')]=function(_0x2a206c,_0x29544e){return function(_0x3535bb){try{var _0x567f81={'priority':_0x29544e[0x0]};var _0x43956a=gotop[_0xe438('0x0')](_0x567f81,{'typecast':!![]});if(_0x43956a[_0xe438('0x7')]){logger[_0xe438('0x8')](_0xe438('0x9'),_0x2a206c,_[_0xe438('0xa')](_0x43956a,_0xe438('0xb'))[_0xe438('0xc')](',\x20'));_0x3535bb['stop']();}else{logger[_0xe438('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x2a206c,_0x567f81['priority']);if(_0x567f81[_0xe438('0xe')]){var _0x41bcbd=_[_0xe438('0xf')](_0x3535bb['rules'](),{'p':_0x567f81[_0xe438('0xe')]});if(_0x41bcbd>=0x0){logger['info'](_0xe438('0x10'),_0x2a206c,_0x567f81['priority']||_0xe438('0x11'),_0x41bcbd);_0x3535bb[_0xe438('0x11')](_0x41bcbd);}else{logger[_0xe438('0xd')](_0xe438('0x12'),_0x2a206c,_0x567f81[_0xe438('0xe')]||'next');_0x3535bb[_0xe438('0x13')]();}}else{_0x3535bb[_0xe438('0x11')]();}}}catch(_0x51dc4c){logger[_0xe438('0x8')](_0xe438('0x9'),_0x2a206c,JSON[_0xe438('0x14')](_0x51dc4c));_0x3535bb[_0xe438('0x13')]();}};};