Built motion from commit 911eb874.|2.6.31
[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 _0x75f0=['routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger'];(function(_0x43c6ae,_0x31e9ec){var _0x129ec5=function(_0x55aca2){while(--_0x55aca2){_0x43c6ae['push'](_0x43c6ae['shift']());}};_0x129ec5(++_0x31e9ec);}(_0x75f0,0x18d));var _0x075f=function(_0x2f837d,_0x20606e){_0x2f837d=_0x2f837d-0x0;var _0x3874a3=_0x75f0[_0x2f837d];return _0x3874a3;};'use strict';var schema=require('validate');var _=require(_0x075f('0x0'));var logger=require(_0x075f('0x1'))(_0x075f('0x2'));var gotop=schema({'priority':{'type':_0x075f('0x3'),'required':!![],'message':_0x075f('0x4')}});exports['consequence']=function(_0x113a00,_0x1afbb3){return function(_0xf39e53){try{var _0x220239={'priority':_0x1afbb3[0x0]};var _0x949319=gotop['validate'](_0x220239,{'typecast':!![]});if(_0x949319[_0x075f('0x5')]){logger[_0x075f('0x6')](_0x075f('0x7'),_0x113a00,_[_0x075f('0x8')](_0x949319,'message')[_0x075f('0x9')](',\x20'));_0xf39e53[_0x075f('0xa')]();}else{logger[_0x075f('0xb')](_0x075f('0xc'),_0x113a00,_0x220239['priority']);if(_0x220239[_0x075f('0xd')]){var _0x26ae9f=_['findIndex'](_0xf39e53[_0x075f('0xe')](),{'p':_0x220239[_0x075f('0xd')]});if(_0x26ae9f>=0x0){logger[_0x075f('0xb')](_0x075f('0xf'),_0x113a00,_0x220239['priority']||_0x075f('0x10'),_0x26ae9f);_0xf39e53[_0x075f('0x10')](_0x26ae9f);}else{logger['info'](_0x075f('0x11'),_0x113a00,_0x220239[_0x075f('0xd')]||_0x075f('0x10'));_0xf39e53['stop']();}}else{_0xf39e53[_0x075f('0x10')]();}}}catch(_0x143517){logger[_0x075f('0x6')](_0x075f('0x7'),_0x113a00,JSON[_0x075f('0x12')](_0x143517));_0xf39e53[_0x075f('0xa')]();}};};