Built motion from commit ab870f9e.|2.5.44
[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 _0xc7d9=['error','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','join','stop','findIndex','rules','priority','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x5c6e2d,_0x1b807b){var _0x11725c=function(_0x4895d5){while(--_0x4895d5){_0x5c6e2d['push'](_0x5c6e2d['shift']());}};_0x11725c(++_0x1b807b);}(_0xc7d9,0xb6));var _0x9c7d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc7d9[_0x1035c1];return _0x308d67;};'use strict';var schema=require(_0x9c7d('0x0'));var _=require('lodash');var logger=require(_0x9c7d('0x1'))(_0x9c7d('0x2'));var gotop=schema({'priority':{'type':_0x9c7d('0x3'),'required':!![],'message':_0x9c7d('0x4')}});exports[_0x9c7d('0x5')]=function(_0x5a1366,_0x4e320e){return function(_0x3e80ce){try{var _0x304143={'priority':_0x4e320e[0x0]};var _0x3de0d3=gotop['validate'](_0x304143,{'typecast':!![]});if(_0x3de0d3['length']){logger['error'](_0x9c7d('0x6'),_0x5a1366,_['map'](_0x3de0d3,'message')[_0x9c7d('0x7')](',\x20'));_0x3e80ce[_0x9c7d('0x8')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x5a1366,_0x304143['priority']);if(_0x304143['priority']){var _0xb8dea3=_[_0x9c7d('0x9')](_0x3e80ce[_0x9c7d('0xa')](),{'p':_0x304143[_0x9c7d('0xb')]});if(_0xb8dea3>=0x0){logger[_0x9c7d('0xc')](_0x9c7d('0xd'),_0x5a1366,_0x304143[_0x9c7d('0xb')]||_0x9c7d('0xe'),_0xb8dea3);_0x3e80ce[_0x9c7d('0xe')](_0xb8dea3);}else{logger[_0x9c7d('0xc')](_0x9c7d('0xf'),_0x5a1366,_0x304143[_0x9c7d('0xb')]||_0x9c7d('0xe'));_0x3e80ce[_0x9c7d('0x8')]();}}else{_0x3e80ce[_0x9c7d('0xe')]();}}}catch(_0x6cb3eb){logger[_0x9c7d('0x10')](_0x9c7d('0x6'),_0x5a1366,JSON[_0x9c7d('0x11')](_0x6cb3eb));_0x3e80ce[_0x9c7d('0x8')]();}};};