1ede62ee8c8224848c06abef7584cc3ab9e7881d
[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 _0xd160=['[%s][GOTOP]\x20priority\x20%s','findIndex','rules','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info'];(function(_0x329239,_0x3a5d3c){var _0x16ae55=function(_0x233a0b){while(--_0x233a0b){_0x329239['push'](_0x329239['shift']());}};_0x16ae55(++_0x3a5d3c);}(_0xd160,0x1ea));var _0x0d16=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0xd160[_0x533528];return _0x3189f1;};'use strict';var schema=require(_0x0d16('0x0'));var _=require(_0x0d16('0x1'));var logger=require(_0x0d16('0x2'))(_0x0d16('0x3'));var gotop=schema({'priority':{'type':_0x0d16('0x4'),'required':!![],'message':_0x0d16('0x5')}});exports['consequence']=function(_0x54eff1,_0x4a9d25){return function(_0x1c1286){try{var _0x216101={'priority':_0x4a9d25[0x0]};var _0x59ea0b=gotop[_0x0d16('0x0')](_0x216101,{'typecast':!![]});if(_0x59ea0b[_0x0d16('0x6')]){logger[_0x0d16('0x7')](_0x0d16('0x8'),_0x54eff1,_[_0x0d16('0x9')](_0x59ea0b,_0x0d16('0xa'))[_0x0d16('0xb')](',\x20'));_0x1c1286[_0x0d16('0xc')]();}else{logger[_0x0d16('0xd')](_0x0d16('0xe'),_0x54eff1,_0x216101['priority']);if(_0x216101['priority']){var _0x44a12c=_[_0x0d16('0xf')](_0x1c1286[_0x0d16('0x10')](),{'p':_0x216101[_0x0d16('0x11')]});if(_0x44a12c>=0x0){logger[_0x0d16('0xd')](_0x0d16('0x12'),_0x54eff1,_0x216101[_0x0d16('0x11')]||'next',_0x44a12c);_0x1c1286[_0x0d16('0x13')](_0x44a12c);}else{logger[_0x0d16('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x54eff1,_0x216101[_0x0d16('0x11')]||'next');_0x1c1286[_0x0d16('0xc')]();}}else{_0x1c1286[_0x0d16('0x13')]();}}}catch(_0x22960e){logger[_0x0d16('0x7')](_0x0d16('0x8'),_0x54eff1,JSON[_0x0d16('0x14')](_0x22960e));_0x1c1286[_0x0d16('0xc')]();}};};