Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / components / parsers / qs.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 _0xa10c=['isEmail','getFullTextValue','forEach','includes','push','lodash','sequelize','moment','split','filters','isEmpty','find','type','DATE','$gte','format','$lte','YYYY-MM-DD','utc','subtract','isArray','parse','limit','offset','sort','map','priority','cast','col','unsigned','substr','DESC','omit','isString','length','unset','match'];(function(_0x4504c2,_0x30b309){var _0x1dc44e=function(_0x10b0a5){while(--_0x10b0a5){_0x4504c2['push'](_0x4504c2['shift']());}};_0x1dc44e(++_0x30b309);}(_0xa10c,0x19c));var _0xca10=function(_0x28d467,_0x44cc87){_0x28d467=_0x28d467-0x0;var _0x14b257=_0xa10c[_0x28d467];return _0x14b257;};'use strict';var _=require(_0xca10('0x0'));var sequelize=require(_0xca10('0x1'));var moment=require(_0xca10('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x225641){var _0x3e79dd=null;if(_0x225641){_0x3e79dd=_0x225641[_0xca10('0x3')](',');}return _0x3e79dd;};exports[_0xca10('0x4')]=function(_0xacb684,_0x255a94){var _0x92cf8a={};if(!_[_0xca10('0x5')](_0xacb684)){_['forOwn'](_0xacb684,function(_0xfa048f,_0x49ee8d){try{if(_0x255a94){var _0x46b18a=_[_0xca10('0x6')](_0x255a94,{'name':_0x49ee8d})||{};if(_0x46b18a[_0xca10('0x7')]===_0xca10('0x8')&&_['isPlainObject'](_0xfa048f)){var _0x4ba549=JSON['parse'](_0xfa048f);var _0x3be561={'$gte':moment(moment(_0x4ba549[_0xca10('0x9')])[_0xca10('0xa')]('YYYY-MM-DD'))['utc']()[_0xca10('0xa')](),'$lte':moment(moment(_0x4ba549[_0xca10('0xb')])['format'](_0xca10('0xc')))[_0xca10('0xd')]()[_0xca10('0xe')](0x1,'s')['format']()};_0x92cf8a[_0x49ee8d]=_0x3be561;}else{_0x92cf8a[_0x49ee8d]=_[_0xca10('0xf')](_0xfa048f)?_0xfa048f:JSON[_0xca10('0x10')](_0xfa048f);}}else{_0x92cf8a[_0x49ee8d]=_[_0xca10('0xf')](_0xfa048f)?_0xfa048f:JSON['parse'](_0xfa048f);}}catch(_0x494878){_0x92cf8a[_0x49ee8d]=_0xfa048f[_0xca10('0x3')](',');}});}return _0x92cf8a;};exports[_0xca10('0x11')]=function(_0x1e2bb4){_0x1e2bb4=parseInt(_0x1e2bb4,0xa);if(!_0x1e2bb4||_0x1e2bb4<0x0){_0x1e2bb4=LIMIT_VALUE;}return _0x1e2bb4;};exports[_0xca10('0x12')]=function(_0x50cbfb){_0x50cbfb=parseInt(_0x50cbfb,0xa);if(!_0x50cbfb||_0x50cbfb<0x0){_0x50cbfb=0x0;}return _0x50cbfb;};exports[_0xca10('0x13')]=function(_0x520f93){var _0x15f891,_0x19dac6=null;if(_0x520f93){_0x15f891=_0x520f93[_0xca10('0x3')](',');_0x19dac6=_[_0xca10('0x14')](_0x15f891,function(_0x7d7cd8){if(_0x7d7cd8['indexOf']('-')===0x0){return[_0x7d7cd8===_0xca10('0x15')?sequelize[_0xca10('0x16')](sequelize[_0xca10('0x17')]('priority'),_0xca10('0x18')):_0x7d7cd8[_0xca10('0x19')](0x1),_0xca10('0x1a')];}else{return[_0x7d7cd8===_0xca10('0x15')?sequelize[_0xca10('0x16')](sequelize[_0xca10('0x17')](_0xca10('0x15')),_0xca10('0x18')):_0x7d7cd8,'ASC'];}});}return _0x19dac6;};exports[_0xca10('0x1b')]=function(_0x13f12c,_0x34e91f){if(_[_0xca10('0x5')](_0x13f12c)){return _0x13f12c;}if(_[_0xca10('0xf')](_0x13f12c)){for(var _0x5b5f2b=0x0;_0x5b5f2b<_0x13f12c['length'];_0x5b5f2b+=0x1){_0x13f12c[_0x5b5f2b]=this[_0xca10('0x1b')](_0x13f12c[_0x5b5f2b],_0x34e91f);}return _0x13f12c;}if(!_['isObject'](_0x13f12c)){return _0x13f12c;}if(_[_0xca10('0x1c')](_0x34e91f)){_0x34e91f=[_0x34e91f];}if(!_['isArray'](_0x34e91f)){return _0x13f12c;}for(var _0x28f952=0x0;_0x28f952<_0x34e91f[_0xca10('0x1d')];_0x28f952+=0x1){_[_0xca10('0x1e')](_0x13f12c,_0x34e91f[_0x28f952]);}for(var _0xf6a051 in _0x13f12c){if(_0x13f12c['hasOwnProperty'](_0xf6a051)){_0x13f12c[_0xf6a051]=this[_0xca10('0x1b')](_0x13f12c[_0xf6a051],_0x34e91f);}}return _0x13f12c;};exports['isNumeric']=function(_0x49236d){return _0x49236d[_0xca10('0x1f')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xca10('0x20')]=function(_0xffeb08){return _0xffeb08['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xca10('0x21')]=function(_0x609db0){var _0xcede42=[];_0x609db0[_0xca10('0x3')](/[ ,]+/)[_0xca10('0x22')](function(_0x5a2177){_0x5a2177=_0x5a2177['replace'](/([^:]")"+/g,'$1');_0x5a2177='+'+_0x5a2177+'*';if(_0x5a2177[_0xca10('0x23')]('@'))_0x5a2177='\x22'+_0x5a2177+'\x22';_0xcede42[_0xca10('0x24')](_0x5a2177);});return _0xcede42['join']('\x20');};