Built motion from commit 25580385.|2.6.2
[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 _0x8ab0=['info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x37ed75,_0x5a3854){var _0x53480f=function(_0x5986c5){while(--_0x5986c5){_0x37ed75['push'](_0x37ed75['shift']());}};_0x53480f(++_0x5a3854);}(_0x8ab0,0x18b));var _0x08ab=function(_0x5df62d,_0x27ec95){_0x5df62d=_0x5df62d-0x0;var _0x3c67b9=_0x8ab0[_0x5df62d];return _0x3c67b9;};'use strict';var schema=require(_0x08ab('0x0'));var _=require('lodash');var logger=require(_0x08ab('0x1'))(_0x08ab('0x2'));var gotop=schema({'priority':{'type':_0x08ab('0x3'),'required':!![],'message':_0x08ab('0x4')}});exports[_0x08ab('0x5')]=function(_0x20735c,_0x55a817){return function(_0x1fb1c2){try{var _0x28eba9={'priority':_0x55a817[0x0]};var _0x2ccffa=gotop[_0x08ab('0x0')](_0x28eba9,{'typecast':!![]});if(_0x2ccffa[_0x08ab('0x6')]){logger['error'](_0x08ab('0x7'),_0x20735c,_[_0x08ab('0x8')](_0x2ccffa,'message')[_0x08ab('0x9')](',\x20'));_0x1fb1c2['stop']();}else{logger['info'](_0x08ab('0xa'),_0x20735c,_0x28eba9[_0x08ab('0xb')]);if(_0x28eba9[_0x08ab('0xb')]){var _0x31ac9d=_[_0x08ab('0xc')](_0x1fb1c2['rules'](),{'p':_0x28eba9[_0x08ab('0xb')]});if(_0x31ac9d>=0x0){logger[_0x08ab('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x20735c,_0x28eba9[_0x08ab('0xb')]||_0x08ab('0xe'),_0x31ac9d);_0x1fb1c2[_0x08ab('0xe')](_0x31ac9d);}else{logger[_0x08ab('0xd')](_0x08ab('0xf'),_0x20735c,_0x28eba9[_0x08ab('0xb')]||_0x08ab('0xe'));_0x1fb1c2[_0x08ab('0x10')]();}}else{_0x1fb1c2[_0x08ab('0xe')]();}}}catch(_0x3b732c){logger['error'](_0x08ab('0x7'),_0x20735c,JSON['stringify'](_0x3b732c));_0x1fb1c2[_0x08ab('0x10')]();}};};