Built motion from commit 616d3211.|2.6.4
[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 _0x8fae=['[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x8fae,0x198));var _0xe8fa=function(_0x4f8b44,_0x4eda31){_0x4f8b44=_0x4f8b44-0x0;var _0x45727b=_0x8fae[_0x4f8b44];return _0x45727b;};'use strict';var schema=require(_0xe8fa('0x0'));var _=require(_0xe8fa('0x1'));var logger=require('../../../../config/logger')(_0xe8fa('0x2'));var gotop=schema({'priority':{'type':_0xe8fa('0x3'),'required':!![],'message':_0xe8fa('0x4')}});exports['consequence']=function(_0x2354ef,_0x22a710){return function(_0x232b50){try{var _0x5603de={'priority':_0x22a710[0x0]};var _0x25d2a7=gotop['validate'](_0x5603de,{'typecast':!![]});if(_0x25d2a7['length']){logger[_0xe8fa('0x5')](_0xe8fa('0x6'),_0x2354ef,_[_0xe8fa('0x7')](_0x25d2a7,_0xe8fa('0x8'))[_0xe8fa('0x9')](',\x20'));_0x232b50[_0xe8fa('0xa')]();}else{logger['info'](_0xe8fa('0xb'),_0x2354ef,_0x5603de['priority']);if(_0x5603de[_0xe8fa('0xc')]){var _0x38e4c0=_[_0xe8fa('0xd')](_0x232b50[_0xe8fa('0xe')](),{'p':_0x5603de[_0xe8fa('0xc')]});if(_0x38e4c0>=0x0){logger[_0xe8fa('0xf')](_0xe8fa('0x10'),_0x2354ef,_0x5603de[_0xe8fa('0xc')]||_0xe8fa('0x11'),_0x38e4c0);_0x232b50['next'](_0x38e4c0);}else{logger[_0xe8fa('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x2354ef,_0x5603de[_0xe8fa('0xc')]||'next');_0x232b50[_0xe8fa('0xa')]();}}else{_0x232b50[_0xe8fa('0x11')]();}}}catch(_0x40e5b0){logger[_0xe8fa('0x5')]('[%s][GOTOP]\x20%s',_0x2354ef,JSON['stringify'](_0x40e5b0));_0x232b50[_0xe8fa('0xa')]();}};};