Built motion from commit 994c64e1.|2.6.1
[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 _0x4899=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','[%s][GOTOP]\x20%s','message','join','stop','info','priority','findIndex','rules'];(function(_0x50c344,_0x4539ba){var _0x199d4c=function(_0x342255){while(--_0x342255){_0x50c344['push'](_0x50c344['shift']());}};_0x199d4c(++_0x4539ba);}(_0x4899,0x144));var _0x9489=function(_0x54de1f,_0x4943ab){_0x54de1f=_0x54de1f-0x0;var _0x2e3564=_0x4899[_0x54de1f];return _0x2e3564;};'use strict';var schema=require(_0x9489('0x0'));var _=require(_0x9489('0x1'));var logger=require(_0x9489('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x9489('0x3')}});exports['consequence']=function(_0x2c5b90,_0x889f19){return function(_0x5a9017){try{var _0x52cd1e={'priority':_0x889f19[0x0]};var _0x44451f=gotop[_0x9489('0x0')](_0x52cd1e,{'typecast':!![]});if(_0x44451f['length']){logger['error'](_0x9489('0x4'),_0x2c5b90,_['map'](_0x44451f,_0x9489('0x5'))[_0x9489('0x6')](',\x20'));_0x5a9017[_0x9489('0x7')]();}else{logger[_0x9489('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0x2c5b90,_0x52cd1e[_0x9489('0x9')]);if(_0x52cd1e['priority']){var _0x339417=_[_0x9489('0xa')](_0x5a9017[_0x9489('0xb')](),{'p':_0x52cd1e[_0x9489('0x9')]});if(_0x339417>=0x0){logger[_0x9489('0x8')](_0x9489('0xc'),_0x2c5b90,_0x52cd1e[_0x9489('0x9')]||_0x9489('0xd'),_0x339417);_0x5a9017[_0x9489('0xd')](_0x339417);}else{logger['info'](_0x9489('0xe'),_0x2c5b90,_0x52cd1e[_0x9489('0x9')]||_0x9489('0xd'));_0x5a9017[_0x9489('0x7')]();}}else{_0x5a9017[_0x9489('0xd')]();}}}catch(_0x2eae08){logger['error'](_0x9489('0x4'),_0x2c5b90,JSON[_0x9489('0xf')](_0x2eae08));_0x5a9017[_0x9489('0x7')]();}};};