Built motion from commit d9028345.|2.5.43
[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 _0x7c5f=['routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','stringify','validate','lodash'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0x7c5f,0x75));var _0xf7c5=function(_0x132f26,_0x4d7721){_0x132f26=_0x132f26-0x0;var _0xcd7910=_0x7c5f[_0x132f26];return _0xcd7910;};'use strict';var schema=require(_0xf7c5('0x0'));var _=require(_0xf7c5('0x1'));var logger=require('../../../../config/logger')(_0xf7c5('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xf7c5('0x3')}});exports['consequence']=function(_0xecbbaf,_0x156be4){return function(_0x6eafdf){try{var _0x33fd01={'priority':_0x156be4[0x0]};var _0x177188=gotop[_0xf7c5('0x0')](_0x33fd01,{'typecast':!![]});if(_0x177188[_0xf7c5('0x4')]){logger['error'](_0xf7c5('0x5'),_0xecbbaf,_['map'](_0x177188,_0xf7c5('0x6'))[_0xf7c5('0x7')](',\x20'));_0x6eafdf[_0xf7c5('0x8')]();}else{logger[_0xf7c5('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0xecbbaf,_0x33fd01[_0xf7c5('0xa')]);if(_0x33fd01[_0xf7c5('0xa')]){var _0x3d8560=_[_0xf7c5('0xb')](_0x6eafdf[_0xf7c5('0xc')](),{'p':_0x33fd01[_0xf7c5('0xa')]});if(_0x3d8560>=0x0){logger[_0xf7c5('0x9')](_0xf7c5('0xd'),_0xecbbaf,_0x33fd01[_0xf7c5('0xa')]||'next',_0x3d8560);_0x6eafdf[_0xf7c5('0xe')](_0x3d8560);}else{logger[_0xf7c5('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0xecbbaf,_0x33fd01['priority']||'next');_0x6eafdf['stop']();}}else{_0x6eafdf[_0xf7c5('0xe')]();}}}catch(_0x1f92bb){logger[_0xf7c5('0xf')]('[%s][GOTOP]\x20%s',_0xecbbaf,JSON[_0xf7c5('0x10')](_0x1f92bb));_0x6eafdf[_0xf7c5('0x8')]();}};};