Built motion from commit (unavailable).|2.4.3
[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 _0xc19b=['stop','priority','findIndex','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','routing','number','consequence','length','error','map','message','join'];(function(_0x3d46e5,_0x565392){var _0x5b9e42=function(_0x1ea63e){while(--_0x1ea63e){_0x3d46e5['push'](_0x3d46e5['shift']());}};_0x5b9e42(++_0x565392);}(_0xc19b,0x75));var _0xbc19=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xc19b[_0x46aff0];return _0x9d78cf;};'use strict';var schema=require(_0xbc19('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0xbc19('0x1'));var gotop=schema({'priority':{'type':_0xbc19('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xbc19('0x3')]=function(_0x22b807,_0x202391){return function(_0x5eb41b){try{var _0x5f5601={'priority':_0x202391[0x0]};var _0x2f1433=gotop['validate'](_0x5f5601,{'typecast':!![]});if(_0x2f1433[_0xbc19('0x4')]){logger[_0xbc19('0x5')]('[%s][GOTOP]\x20%s',_0x22b807,_[_0xbc19('0x6')](_0x2f1433,_0xbc19('0x7'))[_0xbc19('0x8')](',\x20'));_0x5eb41b[_0xbc19('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x22b807,_0x5f5601[_0xbc19('0xa')]);if(_0x5f5601[_0xbc19('0xa')]){var _0xca06b9=_[_0xbc19('0xb')](_0x5eb41b['rules'](),{'p':_0x5f5601[_0xbc19('0xa')]});if(_0xca06b9>=0x0){logger[_0xbc19('0xc')](_0xbc19('0xd'),_0x22b807,_0x5f5601[_0xbc19('0xa')]||_0xbc19('0xe'),_0xca06b9);_0x5eb41b[_0xbc19('0xe')](_0xca06b9);}else{logger[_0xbc19('0xc')](_0xbc19('0xf'),_0x22b807,_0x5f5601['priority']||_0xbc19('0xe'));_0x5eb41b[_0xbc19('0x9')]();}}else{_0x5eb41b[_0xbc19('0xe')]();}}}catch(_0x564104){logger[_0xbc19('0x5')](_0xbc19('0x10'),_0x22b807,JSON[_0xbc19('0x11')](_0x564104));_0x5eb41b['stop']();}};};