Built motion from commit 3d3e98f2.|2.6.29
[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 _0x08dd=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','message','join','[%s][GOTOP]\x20priority\x20%s','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','lodash','routing','number'];(function(_0x6878b9,_0xe05f1f){var _0x1cb8cc=function(_0x5909f4){while(--_0x5909f4){_0x6878b9['push'](_0x6878b9['shift']());}};_0x1cb8cc(++_0xe05f1f);}(_0x08dd,0x183));var _0xd08d=function(_0x227ee4,_0x4c229e){_0x227ee4=_0x227ee4-0x0;var _0x5157ac=_0x08dd[_0x227ee4];return _0x5157ac;};'use strict';var schema=require('validate');var _=require(_0xd08d('0x0'));var logger=require('../../../../config/logger')(_0xd08d('0x1'));var gotop=schema({'priority':{'type':_0xd08d('0x2'),'required':!![],'message':_0xd08d('0x3')}});exports[_0xd08d('0x4')]=function(_0x4469dd,_0x26aa1c){return function(_0x2ab604){try{var _0x3b09c7={'priority':_0x26aa1c[0x0]};var _0x53770e=gotop['validate'](_0x3b09c7,{'typecast':!![]});if(_0x53770e['length']){logger[_0xd08d('0x5')](_0xd08d('0x6'),_0x4469dd,_['map'](_0x53770e,_0xd08d('0x7'))[_0xd08d('0x8')](',\x20'));_0x2ab604['stop']();}else{logger['info'](_0xd08d('0x9'),_0x4469dd,_0x3b09c7[_0xd08d('0xa')]);if(_0x3b09c7['priority']){var _0x9d8439=_['findIndex'](_0x2ab604['rules'](),{'p':_0x3b09c7[_0xd08d('0xa')]});if(_0x9d8439>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4469dd,_0x3b09c7[_0xd08d('0xa')]||_0xd08d('0xb'),_0x9d8439);_0x2ab604[_0xd08d('0xb')](_0x9d8439);}else{logger['info'](_0xd08d('0xc'),_0x4469dd,_0x3b09c7[_0xd08d('0xa')]||'next');_0x2ab604[_0xd08d('0xd')]();}}else{_0x2ab604[_0xd08d('0xb')]();}}}catch(_0x3d9b79){logger[_0xd08d('0x5')](_0xd08d('0x6'),_0x4469dd,JSON[_0xd08d('0xe')](_0x3d9b79));_0x2ab604[_0xd08d('0xd')]();}};};