Built motion from commit 4c579f6b.|2.5.32
[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 _0x20be=['stringify','../../../../config/logger','routing','number','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x4ca426,_0x265a46){var _0x23edec=function(_0xe03a6a){while(--_0xe03a6a){_0x4ca426['push'](_0x4ca426['shift']());}};_0x23edec(++_0x265a46);}(_0x20be,0xfd));var _0xe20b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x20be[_0x19950b];return _0x3c6b41;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xe20b('0x0'))(_0xe20b('0x1'));var gotop=schema({'priority':{'type':_0xe20b('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xe20b('0x3')]=function(_0x197a16,_0x19aea4){return function(_0x44d755){try{var _0x461361={'priority':_0x19aea4[0x0]};var _0x48e34e=gotop[_0xe20b('0x4')](_0x461361,{'typecast':!![]});if(_0x48e34e[_0xe20b('0x5')]){logger[_0xe20b('0x6')](_0xe20b('0x7'),_0x197a16,_[_0xe20b('0x8')](_0x48e34e,'message')['join'](',\x20'));_0x44d755[_0xe20b('0x9')]();}else{logger[_0xe20b('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x197a16,_0x461361[_0xe20b('0xb')]);if(_0x461361[_0xe20b('0xb')]){var _0x3b2ac2=_[_0xe20b('0xc')](_0x44d755[_0xe20b('0xd')](),{'p':_0x461361[_0xe20b('0xb')]});if(_0x3b2ac2>=0x0){logger['info'](_0xe20b('0xe'),_0x197a16,_0x461361[_0xe20b('0xb')]||_0xe20b('0xf'),_0x3b2ac2);_0x44d755[_0xe20b('0xf')](_0x3b2ac2);}else{logger[_0xe20b('0xa')](_0xe20b('0x10'),_0x197a16,_0x461361['priority']||'next');_0x44d755[_0xe20b('0x9')]();}}else{_0x44d755[_0xe20b('0xf')]();}}}catch(_0x5a85a9){logger[_0xe20b('0x6')](_0xe20b('0x7'),_0x197a16,JSON[_0xe20b('0x11')](_0x5a85a9));_0x44d755[_0xe20b('0x9')]();}};};