Built motion from commit (unavailable).|2.5.9
[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 _0x79a3=['isEmpty','find','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','utc','subtract','isArray','limit','offset','sort','map','indexOf','priority','substr','DESC','col','unsigned','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isEmail','match','includes','push','join','sequelize','split','filters'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0x79a3,0x69));var _0x379a=function(_0xa45c52,_0xc77982){_0xa45c52=_0xa45c52-0x0;var _0x2f6c50=_0x79a3[_0xa45c52];return _0x2f6c50;};'use strict';var _=require('lodash');var sequelize=require(_0x379a('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x396d01){var _0x4c10e9=null;if(_0x396d01){_0x4c10e9=_0x396d01[_0x379a('0x1')](',');}return _0x4c10e9;};exports[_0x379a('0x2')]=function(_0x4f1d6d,_0x46be7a){var _0xd17b31={};if(!_[_0x379a('0x3')](_0x4f1d6d)){_['forOwn'](_0x4f1d6d,function(_0x4e340d,_0x32312f){try{if(_0x46be7a){var _0x1f1968=_[_0x379a('0x4')](_0x46be7a,{'name':_0x32312f})||{};if(_0x1f1968[_0x379a('0x5')]===_0x379a('0x6')&&_[_0x379a('0x7')](_0x4e340d)){var _0x2aa589=JSON[_0x379a('0x8')](_0x4e340d);var _0x230858={'$gte':moment(moment(_0x2aa589['$gte'])[_0x379a('0x9')](_0x379a('0xa')))['utc']()['format'](),'$lte':moment(moment(_0x2aa589['$lte'])[_0x379a('0x9')](_0x379a('0xa')))[_0x379a('0xb')]()[_0x379a('0xc')](0x1,'s')['format']()};_0xd17b31[_0x32312f]=_0x230858;}else{_0xd17b31[_0x32312f]=_[_0x379a('0xd')](_0x4e340d)?_0x4e340d:JSON[_0x379a('0x8')](_0x4e340d);}}else{_0xd17b31[_0x32312f]=_[_0x379a('0xd')](_0x4e340d)?_0x4e340d:JSON[_0x379a('0x8')](_0x4e340d);}}catch(_0x38512a){_0xd17b31[_0x32312f]=_0x4e340d[_0x379a('0x1')](',');}});}return _0xd17b31;};exports[_0x379a('0xe')]=function(_0x54c964){_0x54c964=parseInt(_0x54c964,0xa);if(!_0x54c964||_0x54c964<0x0){_0x54c964=LIMIT_VALUE;}return _0x54c964;};exports[_0x379a('0xf')]=function(_0x51de81){_0x51de81=parseInt(_0x51de81,0xa);if(!_0x51de81||_0x51de81<0x0){_0x51de81=0x0;}return _0x51de81;};exports[_0x379a('0x10')]=function(_0x1d5198){var _0x5c5eef,_0x2f830f=null;if(_0x1d5198){_0x5c5eef=_0x1d5198[_0x379a('0x1')](',');_0x2f830f=_[_0x379a('0x11')](_0x5c5eef,function(_0x2294b5){if(_0x2294b5[_0x379a('0x12')]('-')===0x0){return[_0x2294b5==='priority'?sequelize['cast'](sequelize['col'](_0x379a('0x13')),'unsigned'):_0x2294b5[_0x379a('0x14')](0x1),_0x379a('0x15')];}else{return[_0x2294b5===_0x379a('0x13')?sequelize['cast'](sequelize[_0x379a('0x16')]('priority'),_0x379a('0x17')):_0x2294b5,_0x379a('0x18')];}});}return _0x2f830f;};exports[_0x379a('0x19')]=function(_0xf52d25,_0x48d293){if(_['isEmpty'](_0xf52d25)){return _0xf52d25;}if(_[_0x379a('0xd')](_0xf52d25)){for(var _0x2f1992=0x0;_0x2f1992<_0xf52d25[_0x379a('0x1a')];_0x2f1992+=0x1){_0xf52d25[_0x2f1992]=this['omit'](_0xf52d25[_0x2f1992],_0x48d293);}return _0xf52d25;}if(!_[_0x379a('0x1b')](_0xf52d25)){return _0xf52d25;}if(_[_0x379a('0x1c')](_0x48d293)){_0x48d293=[_0x48d293];}if(!_[_0x379a('0xd')](_0x48d293)){return _0xf52d25;}for(var _0x2ad24f=0x0;_0x2ad24f<_0x48d293['length'];_0x2ad24f+=0x1){_[_0x379a('0x1d')](_0xf52d25,_0x48d293[_0x2ad24f]);}for(var _0x8dae5d in _0xf52d25){if(_0xf52d25[_0x379a('0x1e')](_0x8dae5d)){_0xf52d25[_0x8dae5d]=this[_0x379a('0x19')](_0xf52d25[_0x8dae5d],_0x48d293);}}return _0xf52d25;};exports['isNumeric']=function(_0x5312e4){return _0x5312e4['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x379a('0x1f')]=function(_0x351d0f){return _0x351d0f[_0x379a('0x20')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4c5b7c){var _0x401990=[];_0x4c5b7c[_0x379a('0x1')](/[ ,]+/)['forEach'](function(_0xa7e4b){_0xa7e4b=_0xa7e4b['replace'](/([^:]")"+/g,'$1');_0xa7e4b='+'+_0xa7e4b+'*';if(_0xa7e4b[_0x379a('0x21')]('@'))_0xa7e4b='\x22'+_0xa7e4b+'\x22';_0x401990[_0x379a('0x22')](_0xa7e4b);});return _0x401990[_0x379a('0x23')]('\x20');};