2ee3195dc74568b166590ae7d7e5c22bac2c3b67
[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 _0x53a2=['stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','[%s][GOTOP]\x20%s','map','join'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x53a2,0x91));var _0x253a=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x53a2[_0x18ab2a];return _0x16dcee;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require('../../../../config/logger')(_0x253a('0x0'));var gotop=schema({'priority':{'type':_0x253a('0x1'),'required':!![],'message':_0x253a('0x2')}});exports['consequence']=function(_0x126433,_0xd7272a){return function(_0x120311){try{var _0x46044c={'priority':_0xd7272a[0x0]};var _0x157c78=gotop[_0x253a('0x3')](_0x46044c,{'typecast':!![]});if(_0x157c78[_0x253a('0x4')]){logger['error'](_0x253a('0x5'),_0x126433,_[_0x253a('0x6')](_0x157c78,'message')[_0x253a('0x7')](',\x20'));_0x120311[_0x253a('0x8')]();}else{logger[_0x253a('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x126433,_0x46044c[_0x253a('0xa')]);if(_0x46044c[_0x253a('0xa')]){var _0x5166b1=_[_0x253a('0xb')](_0x120311['rules'](),{'p':_0x46044c[_0x253a('0xa')]});if(_0x5166b1>=0x0){logger[_0x253a('0x9')](_0x253a('0xc'),_0x126433,_0x46044c[_0x253a('0xa')]||'next',_0x5166b1);_0x120311[_0x253a('0xd')](_0x5166b1);}else{logger[_0x253a('0x9')](_0x253a('0xe'),_0x126433,_0x46044c[_0x253a('0xa')]||_0x253a('0xd'));_0x120311[_0x253a('0x8')]();}}else{_0x120311[_0x253a('0xd')]();}}}catch(_0x195f19){logger[_0x253a('0xf')](_0x253a('0x5'),_0x126433,JSON[_0x253a('0x10')](_0x195f19));_0x120311[_0x253a('0x8')]();}};};