2400274c3dba01dab95ae9ce4ba5e23f5b11d004
[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 _0xc451=['stringify','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s'];(function(_0x5ebc9a,_0x405dcd){var _0x20d5ae=function(_0x43c067){while(--_0x43c067){_0x5ebc9a['push'](_0x5ebc9a['shift']());}};_0x20d5ae(++_0x405dcd);}(_0xc451,0x8d));var _0x1c45=function(_0x28da7d,_0x360718){_0x28da7d=_0x28da7d-0x0;var _0x53a718=_0xc451[_0x28da7d];return _0x53a718;};'use strict';var schema=require('validate');var _=require(_0x1c45('0x0'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0x1c45('0x1'),'required':!![],'message':_0x1c45('0x2')}});exports[_0x1c45('0x3')]=function(_0x4f6eb2,_0x32b676){return function(_0x8e6904){try{var _0x1a068c={'priority':_0x32b676[0x0]};var _0x4dbc78=gotop[_0x1c45('0x4')](_0x1a068c,{'typecast':!![]});if(_0x4dbc78['length']){logger[_0x1c45('0x5')]('[%s][GOTOP]\x20%s',_0x4f6eb2,_[_0x1c45('0x6')](_0x4dbc78,_0x1c45('0x7'))[_0x1c45('0x8')](',\x20'));_0x8e6904[_0x1c45('0x9')]();}else{logger[_0x1c45('0xa')](_0x1c45('0xb'),_0x4f6eb2,_0x1a068c[_0x1c45('0xc')]);if(_0x1a068c[_0x1c45('0xc')]){var _0x5acf3e=_[_0x1c45('0xd')](_0x8e6904[_0x1c45('0xe')](),{'p':_0x1a068c[_0x1c45('0xc')]});if(_0x5acf3e>=0x0){logger[_0x1c45('0xa')](_0x1c45('0xf'),_0x4f6eb2,_0x1a068c[_0x1c45('0xc')]||_0x1c45('0x10'),_0x5acf3e);_0x8e6904[_0x1c45('0x10')](_0x5acf3e);}else{logger[_0x1c45('0xa')](_0x1c45('0x11'),_0x4f6eb2,_0x1a068c[_0x1c45('0xc')]||_0x1c45('0x10'));_0x8e6904[_0x1c45('0x9')]();}}else{_0x8e6904[_0x1c45('0x10')]();}}}catch(_0x183ffb){logger[_0x1c45('0x5')](_0x1c45('0x12'),_0x4f6eb2,JSON[_0x1c45('0x13')](_0x183ffb));_0x8e6904[_0x1c45('0x9')]();}};};