c640643850a7370c47dafd92e273b5942df97d41
[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 _0x55c7=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','map','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0x55c7,0x195));var _0x755c=function(_0x353194,_0x105f4e){_0x353194=_0x353194-0x0;var _0x321a62=_0x55c7[_0x353194];return _0x321a62;};'use strict';var schema=require(_0x755c('0x0'));var _=require('lodash');var logger=require(_0x755c('0x1'))(_0x755c('0x2'));var gotop=schema({'priority':{'type':_0x755c('0x3'),'required':!![],'message':_0x755c('0x4')}});exports['consequence']=function(_0x1b7566,_0x4b8962){return function(_0x597d17){try{var _0xacc087={'priority':_0x4b8962[0x0]};var _0x243c08=gotop[_0x755c('0x0')](_0xacc087,{'typecast':!![]});if(_0x243c08[_0x755c('0x5')]){logger[_0x755c('0x6')]('[%s][GOTOP]\x20%s',_0x1b7566,_[_0x755c('0x7')](_0x243c08,'message')['join'](',\x20'));_0x597d17[_0x755c('0x8')]();}else{logger[_0x755c('0x9')](_0x755c('0xa'),_0x1b7566,_0xacc087['priority']);if(_0xacc087[_0x755c('0xb')]){var _0x366aa4=_[_0x755c('0xc')](_0x597d17[_0x755c('0xd')](),{'p':_0xacc087[_0x755c('0xb')]});if(_0x366aa4>=0x0){logger[_0x755c('0x9')](_0x755c('0xe'),_0x1b7566,_0xacc087[_0x755c('0xb')]||'next',_0x366aa4);_0x597d17[_0x755c('0xf')](_0x366aa4);}else{logger[_0x755c('0x9')](_0x755c('0x10'),_0x1b7566,_0xacc087['priority']||'next');_0x597d17[_0x755c('0x8')]();}}else{_0x597d17[_0x755c('0xf')]();}}}catch(_0x346a08){logger[_0x755c('0x6')](_0x755c('0x11'),_0x1b7566,JSON[_0x755c('0x12')](_0x346a08));_0x597d17[_0x755c('0x8')]();}};};