Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / api / voicePrefix / voicePrefix.controller.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 _0x15b2=['status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','model','query','keys','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','params','describe','create','sequelize','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','from-sip','app','type','system','description','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','update','system-','transaction','findById','ids','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voicePrefix.socket','register'];(function(_0x19ac2f,_0x5cd631){var _0x2b9d9a=function(_0x2eef32){while(--_0x2eef32){_0x19ac2f['push'](_0x19ac2f['shift']());}};_0x2b9d9a(++_0x5cd631);}(_0x15b2,0x145));var _0x215b=function(_0x41fe72,_0xaa8f97){_0x41fe72=_0x41fe72-0x0;var _0x717fdf=_0x15b2[_0x41fe72];return _0x717fdf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x215b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x215b('0x1'));var jsonpatch=require(_0x215b('0x2'));var rp=require('request-promise');var moment=require(_0x215b('0x3'));var BPromise=require(_0x215b('0x4'));var Mustache=require(_0x215b('0x5'));var util=require(_0x215b('0x6'));var path=require('path');var sox=require(_0x215b('0x7'));var csv=require('to-csv');var ejs=require(_0x215b('0x8'));var fs=require('fs');var _=require(_0x215b('0x9'));var squel=require(_0x215b('0xa'));var crypto=require(_0x215b('0xb'));var jsforce=require(_0x215b('0xc'));var deskjs=require(_0x215b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x215b('0xe'));var Papa=require(_0x215b('0xf'));var Redis=require('ioredis');var authService=require(_0x215b('0x10'));var qs=require(_0x215b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x215b('0x12'))('api');var utils=require(_0x215b('0x13'));var config=require(_0x215b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x215b('0x15'))['db'];config['redis']=_['defaults'](config[_0x215b('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x215b('0x17'))(new Redis(config['redis']));require(_0x215b('0x18'))[_0x215b('0x19')](socket);function respondWithStatusCode(_0x38d765,_0x4ed24c){_0x4ed24c=_0x4ed24c||0xcc;return function(_0x495178){if(_0x495178){return _0x38d765['sendStatus'](_0x4ed24c);}return _0x38d765[_0x215b('0x1a')](_0x4ed24c)[_0x215b('0x1b')]();};}function respondWithResult(_0x2d04cb,_0x2e96f5){_0x2e96f5=_0x2e96f5||0xc8;return function(_0x35508e){if(_0x35508e){return _0x2d04cb[_0x215b('0x1a')](_0x2e96f5)[_0x215b('0x1c')](_0x35508e);}};}function respondWithFilteredResult(_0x4a27aa,_0x31d565){return function(_0x2ca496){if(_0x2ca496){var _0x2fd65=_0x2ca496[_0x215b('0x1d')],_0x37248f=_0x31d565[_0x215b('0x1e')],_0x3f18e4=_0x31d565['offset']+_0x31d565['limit'],_0x4492da;if(_0x3f18e4>=_0x2fd65){_0x3f18e4=_0x2fd65;_0x4492da=0xc8;}else{_0x4492da=0xce;}_0x4a27aa[_0x215b('0x1a')](_0x4492da);return _0x4a27aa['set'](_0x215b('0x1f'),_0x37248f+'-'+_0x3f18e4+'/'+_0x2fd65)[_0x215b('0x1c')](_0x2ca496);}return null;};}function patchUpdates(_0x2f9ed2){return function(_0x303c89){try{jsonpatch[_0x215b('0x20')](_0x303c89,_0x2f9ed2,!![]);}catch(_0x1a40a5){return BPromise[_0x215b('0x21')](_0x1a40a5);}return _0x303c89[_0x215b('0x22')]();};}function saveUpdates(_0x5cce5d,_0x4b31c3){return function(_0x33ef47){if(_0x33ef47){return _0x33ef47['update'](_0x5cce5d)[_0x215b('0x23')](function(_0x267af9){return _0x267af9;});}return null;};}function removeEntity(_0x48568a,_0x91587a){return function(_0x55efe7){if(_0x55efe7){return _0x55efe7[_0x215b('0x24')]()[_0x215b('0x23')](function(){var _0x1b7c12=_0x55efe7[_0x215b('0x25')]({'plain':!![]});var _0x1f30b1=_0x215b('0x26');return db[_0x215b('0x27')][_0x215b('0x24')]({'where':{'type':_0x1f30b1,'resourceId':_0x1b7c12['id']}})['then'](function(){return _0x55efe7;});})[_0x215b('0x23')](function(){_0x48568a[_0x215b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40eb6e,_0x191c50){return function(_0x1470ac){if(!_0x1470ac){_0x40eb6e['sendStatus'](0x194);}return _0x1470ac;};}function handleError(_0x23ffca,_0x41b373){_0x41b373=_0x41b373||0x1f4;return function(_0x1471a9){logger[_0x215b('0x28')](_0x1471a9[_0x215b('0x29')]);if(_0x1471a9[_0x215b('0x2a')]){delete _0x1471a9['name'];}_0x23ffca[_0x215b('0x1a')](_0x41b373)[_0x215b('0x2b')](_0x1471a9);};}exports[_0x215b('0x2c')]=function(_0x1d449b,_0x5eb42b){var _0x59f802={},_0x581256={},_0x4f83a2={'count':0x0,'rows':[]};var _0x48f0d6=_[_0x215b('0x2d')](db[_0x215b('0x2e')][_0x215b('0x2f')],function(_0xd25833){return{'name':_0xd25833['fieldName'],'type':_0xd25833['type']['key']};});_0x581256[_0x215b('0x30')]=_['map'](_0x48f0d6,'name');_0x581256[_0x215b('0x31')]=_[_0x215b('0x32')](_0x1d449b[_0x215b('0x31')]);_0x581256['filters']=_[_0x215b('0x33')](_0x581256[_0x215b('0x30')],_0x581256['query']);_0x59f802['attributes']=_[_0x215b('0x33')](_0x581256['model'],qs[_0x215b('0x34')](_0x1d449b['query']['fields']));_0x59f802[_0x215b('0x35')]=_0x59f802[_0x215b('0x35')][_0x215b('0x36')]?_0x59f802['attributes']:_0x581256[_0x215b('0x30')];if(!_0x1d449b['query']['hasOwnProperty'](_0x215b('0x37'))){_0x59f802[_0x215b('0x38')]=qs[_0x215b('0x38')](_0x1d449b[_0x215b('0x31')][_0x215b('0x38')]);_0x59f802[_0x215b('0x1e')]=qs['offset'](_0x1d449b[_0x215b('0x31')][_0x215b('0x1e')]);}_0x59f802['order']=qs[_0x215b('0x39')](_0x1d449b[_0x215b('0x31')][_0x215b('0x39')]);_0x59f802[_0x215b('0x3a')]=qs['filters'](_[_0x215b('0x3b')](_0x1d449b[_0x215b('0x31')],_0x581256[_0x215b('0x3c')]),_0x48f0d6);if(_0x1d449b[_0x215b('0x31')][_0x215b('0x3d')]){_0x59f802[_0x215b('0x3a')]=_['merge'](_0x59f802['where'],{'$or':_[_0x215b('0x2d')](_0x48f0d6,function(_0x41ecf6){if(_0x41ecf6['type']!==_0x215b('0x3e')){var _0x9e73cc={};_0x9e73cc[_0x41ecf6[_0x215b('0x2a')]]={'$like':'%'+_0x1d449b['query'][_0x215b('0x3d')]+'%'};return _0x9e73cc;}})});}_0x59f802=_[_0x215b('0x3f')]({},_0x59f802,_0x1d449b[_0x215b('0x40')]);var _0x5ee11b={'where':_0x59f802[_0x215b('0x3a')]};return db['VoicePrefix']['count'](_0x5ee11b)[_0x215b('0x23')](function(_0x44e38d){_0x4f83a2[_0x215b('0x1d')]=_0x44e38d;if(_0x1d449b['query'][_0x215b('0x41')]){_0x59f802[_0x215b('0x42')]=[{'all':!![]}];}return db[_0x215b('0x2e')][_0x215b('0x43')](_0x59f802);})['then'](function(_0x3cb153){_0x4f83a2[_0x215b('0x44')]=_0x3cb153;return _0x4f83a2;})[_0x215b('0x23')](respondWithFilteredResult(_0x5eb42b,_0x59f802))[_0x215b('0x45')](handleError(_0x5eb42b,null));};exports[_0x215b('0x46')]=function(_0x52a475,_0x48aef5){var _0x520d5d={'raw':![],'where':{'id':_0x52a475['params']['id']}},_0x2a269c={};_0x2a269c[_0x215b('0x30')]=_[_0x215b('0x32')](db[_0x215b('0x2e')][_0x215b('0x2f')]);_0x2a269c[_0x215b('0x31')]=_['keys'](_0x52a475['query']);_0x2a269c[_0x215b('0x3c')]=_['intersection'](_0x2a269c[_0x215b('0x30')],_0x2a269c[_0x215b('0x31')]);_0x520d5d[_0x215b('0x35')]=_[_0x215b('0x33')](_0x2a269c['model'],qs[_0x215b('0x34')](_0x52a475[_0x215b('0x31')][_0x215b('0x34')]));_0x520d5d['attributes']=_0x520d5d[_0x215b('0x35')][_0x215b('0x36')]?_0x520d5d[_0x215b('0x35')]:_0x2a269c[_0x215b('0x30')];if(_0x52a475['query'][_0x215b('0x41')]){_0x520d5d['include']=[{'all':!![]}];}_0x520d5d=_[_0x215b('0x3f')]({},_0x520d5d,_0x52a475[_0x215b('0x40')]);return db['VoicePrefix'][_0x215b('0x47')](_0x520d5d)[_0x215b('0x23')](handleEntityNotFound(_0x48aef5,null))['then'](respondWithResult(_0x48aef5,null))['catch'](handleError(_0x48aef5,null));};exports[_0x215b('0x24')]=function(_0x42f8a9,_0x33a520){return db['VoicePrefix'][_0x215b('0x47')]({'where':{'id':_0x42f8a9[_0x215b('0x48')]['id']}})[_0x215b('0x23')](handleEntityNotFound(_0x33a520,null))[_0x215b('0x23')](removeEntity(_0x33a520,null))['catch'](handleError(_0x33a520,null));};exports[_0x215b('0x49')]=function(_0x5ece9b,_0x2b3960){return db[_0x215b('0x2e')][_0x215b('0x49')]()['then'](respondWithResult(_0x2b3960,null))[_0x215b('0x45')](handleError(_0x2b3960,null));};exports[_0x215b('0x4a')]=function(_0x570581,_0x535f37){var _0x2f93f9;return db[_0x215b('0x4b')]['transaction'](function(_0x389f34){return db[_0x215b('0x2e')][_0x215b('0x4a')](_0x570581[_0x215b('0x4c')],{'transaction':_0x389f34})[_0x215b('0x23')](function(_0x2bcbd3){_0x2f93f9=_0x2bcbd3[_0x215b('0x25')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x2f93f9[_0x215b('0x4d')]},'raw':!![]})[_0x215b('0x23')](function(_0x521c82){return createVoicePrefixExtensions(_0x2f93f9,_0x521c82,_0x389f34);});});})[_0x215b('0x23')](function(){var _0x1cfef3=_0x570581[_0x215b('0x4e')][_0x215b('0x25')]({'plain':!![]});if(!_0x1cfef3)throw new Error(_0x215b('0x4f'));if(_0x1cfef3['role']===_0x215b('0x4e')){var _0x30bc07=_0x2f93f9;return db[_0x215b('0x50')]['find']({'where':{'name':_0x215b('0x26'),'userProfileId':_0x1cfef3[_0x215b('0x51')]},'raw':!![]})[_0x215b('0x23')](function(_0x56688f){if(_0x56688f&&_0x56688f['autoAssociation']===0x0){return db[_0x215b('0x27')]['create']({'name':_0x30bc07[_0x215b('0x2a')],'resourceId':_0x30bc07['id'],'type':_0x56688f['name'],'sectionId':_0x56688f['id']},{})[_0x215b('0x23')](function(){return _0x2f93f9;});}else{return _0x2f93f9;}})['catch'](function(_0x41b139){logger[_0x215b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41b139);throw _0x41b139;});}return _0x2f93f9;})[_0x215b('0x23')](respondWithResult(_0x535f37,null))['catch'](handleError(_0x535f37,null));};function Extension(_0x2e2a5e,_0x35b870,_0xe10156,_0x6b9c12){this['context']=_0x215b('0x52');this['exten']=_0x2e2a5e;this[_0x215b('0x53')]=_0xe10156;this[_0x215b('0x54')]=_0x215b('0x55');this[_0x215b('0x56')]='Voice\x20Prefix\x20Extension';this['priority']=_0x35b870;this[_0x215b('0x57')]=_0x6b9c12;}function createVoicePrefixExtensions(_0x474020,_0x3bb3c5,_0x1b9aa5){return new BPromise(function(_0x18ad3e,_0x2a66d3){var _0x3aa26e=new Extension(formatPrefixName(_0x474020[_0x215b('0x58')]),0x1,_0x215b('0x59'),'Voice\x20Prefix');_0x3aa26e[_0x215b('0x5a')]=_0x474020['id'];return db[_0x215b('0x5b')][_0x215b('0x4a')](_0x3aa26e,{'transaction':_0x1b9aa5})[_0x215b('0x23')](function(_0x279b42){var _0x2c5a23=_0x279b42[_0x215b('0x25')]({'plain':!![]});var _0x19c629=_[_0x215b('0x2d')](addVoicePrefixExtensions(_0x474020,_0x3bb3c5),function(_0x13192c){_0x13192c[_0x215b('0x4d')]=_0x2c5a23['id'];_0x13192c[_0x215b('0x5a')]=_0x474020['id'];return _0x13192c;});return db[_0x215b('0x5b')][_0x215b('0x5c')](_0x19c629,{'transaction':_0x1b9aa5})['then'](function(_0x319b8d){if(!_0x319b8d){return _0x2a66d3(_0x215b('0x5d'));}else{return _0x18ad3e(_0x319b8d);}})[_0x215b('0x45')](function(_0x820a9b){return _0x2a66d3(_0x820a9b);});});;});};function addVoicePrefixExtensions(_0x4e13f8,_0x5e5c4e){var _0x173ff3=[];var _0x16a4de=formatPrefixName(_0x4e13f8[_0x215b('0x58')]);_0x173ff3[_0x215b('0x5e')](new Extension(_0x16a4de,0x2,'Set',_0x215b('0x5f')+_0x4e13f8['name']));if(_0x4e13f8[_0x215b('0x60')]){_0x173ff3[_0x215b('0x5e')](new Extension(_0x16a4de,0x3,_0x215b('0x61'),_0x215b('0x62')+_0x4e13f8[_0x215b('0x60')]));}else{_0x173ff3[_0x215b('0x5e')](new Extension(_0x16a4de,0x3,'NoOp',_0x215b('0x63')));}_0x173ff3[_0x215b('0x5e')](new Extension(_0x16a4de,0x4,_0x215b('0x64'),_0x5e5c4e[_0x215b('0x65')]+','+_0x215b('0x66')+(0x8+_0x4e13f8[_0x215b('0x2a')]['length'])+'}'+','+0x1));return _0x173ff3;}function formatPrefixName(_0xe026c4){var _0x3ff49d='_';for(var _0x106595=0x0;_0x106595<_0xe026c4['length'];_0x106595++){if(_0xe026c4[_0x215b('0x67')](_0x106595)=='-'){_0x3ff49d+=_0xe026c4[_0x215b('0x67')](_0x106595);}else{_0x3ff49d+='['+_0xe026c4['charAt'](_0x106595)+']';}}_0x3ff49d+='.';return _0x3ff49d;}exports[_0x215b('0x68')]=function(_0x2275b7,_0x5cc8cc,_0x350e42){var _0x1ce54d=_0x2275b7['body'];_0x1ce54d['prefix']=_0x215b('0x69')+_0x1ce54d[_0x215b('0x2a')]+'-';return db['sequelize'][_0x215b('0x6a')](function(_0x4c7092){return db[_0x215b('0x2e')]['update'](_0x1ce54d,{'where':{'id':_0x1ce54d['id']},'transaction':_0x4c7092})[_0x215b('0x23')](function(){return db[_0x215b('0x5b')]['destroy']({'where':{'VoicePrefixId':_0x1ce54d['id']},'transaction':_0x4c7092})[_0x215b('0x23')](function(){return db['VoiceExtension'][_0x215b('0x47')]({'where':{'id':_0x1ce54d[_0x215b('0x4d')]},'raw':!![]})[_0x215b('0x23')](function(_0x278578){return createVoicePrefixExtensions(_0x1ce54d,_0x278578,_0x4c7092);});});});})[_0x215b('0x23')](function(){return db[_0x215b('0x2e')][_0x215b('0x6b')](_0x1ce54d['id']);})[_0x215b('0x23')](respondWithResult(_0x5cc8cc,null))[_0x215b('0x45')](handleError(_0x5cc8cc,null));};exports['addAgents']=function(_0x1a0989,_0x588b17,_0x2f8c13){return db[_0x215b('0x2e')][_0x215b('0x47')]({'where':{'id':_0x1a0989[_0x215b('0x48')]['id']}})[_0x215b('0x23')](handleEntityNotFound(_0x588b17,null))[_0x215b('0x23')](function(_0x1276ef){if(_0x1276ef){return _0x1276ef['addAgents'](_0x1a0989['body'][_0x215b('0x6c')],_['omit'](_0x1a0989[_0x215b('0x4c')],[_0x215b('0x6c'),'id'])||{})[_0x215b('0x6d')](function(_0x109711){for(var _0x499699=0x0;_0x499699<_0x1a0989[_0x215b('0x4c')][_0x215b('0x6c')]['length'];_0x499699+=0x1){socket['emit'](_0x215b('0x6e'),{'UserId':_0x1a0989[_0x215b('0x4c')]['ids'][_0x499699],'VoicePrefixId':_0x1a0989[_0x215b('0x48')]['id']});}return _0x109711;});}})[_0x215b('0x23')](respondWithResult(_0x588b17,null))[_0x215b('0x45')](handleError(_0x588b17,null));};exports['removeAgents']=function(_0x2e8a49,_0x3ba7ab,_0x4b40a8){return db[_0x215b('0x2e')][_0x215b('0x47')]({'where':{'id':_0x2e8a49[_0x215b('0x48')]['id']}})[_0x215b('0x23')](handleEntityNotFound(_0x3ba7ab,null))[_0x215b('0x23')](function(_0x473b8d){if(_0x473b8d){return _0x473b8d[_0x215b('0x6f')](_0x2e8a49[_0x215b('0x31')][_0x215b('0x6c')])[_0x215b('0x23')](function(){if(_['isArray'](_0x2e8a49[_0x215b('0x31')][_0x215b('0x6c')])){for(var _0x3a0249=0x0;_0x3a0249<_0x2e8a49[_0x215b('0x31')][_0x215b('0x6c')][_0x215b('0x36')];_0x3a0249+=0x1){socket[_0x215b('0x70')](_0x215b('0x71'),{'UserId':Number(_0x2e8a49[_0x215b('0x31')][_0x215b('0x6c')][_0x3a0249]),'VoicePrefixId':Number(_0x2e8a49['params']['id'])});}}else{socket[_0x215b('0x70')](_0x215b('0x71'),{'UserId':Number(_0x2e8a49[_0x215b('0x31')][_0x215b('0x6c')]),'VoicePrefixId':Number(_0x2e8a49[_0x215b('0x48')]['id'])});}});}})[_0x215b('0x23')](respondWithStatusCode(_0x3ba7ab,null))[_0x215b('0x45')](handleError(_0x3ba7ab,null));};exports[_0x215b('0x72')]=function(_0x53efe9,_0x426095,_0x58d61c){var _0x2f5654={};var _0x4ee4a1={};var _0x114ce3;var _0x4546c5;return db[_0x215b('0x2e')][_0x215b('0x73')]({'where':{'id':_0x53efe9['params']['id']}})[_0x215b('0x23')](handleEntityNotFound(_0x426095,null))['then'](function(_0x1ecf50){if(_0x1ecf50){_0x114ce3=_0x1ecf50;_0x4ee4a1['model']=_[_0x215b('0x32')](db[_0x215b('0x74')][_0x215b('0x2f')]);_0x4ee4a1[_0x215b('0x31')]=_[_0x215b('0x32')](_0x53efe9['query']);_0x4ee4a1['filters']=_[_0x215b('0x33')](_0x4ee4a1[_0x215b('0x30')],_0x4ee4a1['query']);_0x2f5654[_0x215b('0x35')]=_['intersection'](_0x4ee4a1[_0x215b('0x30')],qs[_0x215b('0x34')](_0x53efe9[_0x215b('0x31')][_0x215b('0x34')]));_0x2f5654[_0x215b('0x35')]=_0x2f5654[_0x215b('0x35')][_0x215b('0x36')]?_0x2f5654[_0x215b('0x35')]:_0x4ee4a1[_0x215b('0x30')];_0x2f5654['order']=qs[_0x215b('0x39')](_0x53efe9[_0x215b('0x31')][_0x215b('0x39')]);_0x2f5654[_0x215b('0x3a')]=qs[_0x215b('0x3c')](_[_0x215b('0x3b')](_0x53efe9[_0x215b('0x31')],_0x4ee4a1[_0x215b('0x3c')]));if(_0x53efe9[_0x215b('0x31')]['filter']){_0x2f5654[_0x215b('0x3a')]=_['merge'](_0x2f5654['where'],{'$or':_[_0x215b('0x2d')](_0x2f5654[_0x215b('0x35')],function(_0x2f3746){var _0x2fea28={};_0x2fea28[_0x2f3746]={'$like':'%'+_0x53efe9[_0x215b('0x31')][_0x215b('0x3d')]+'%'};return _0x2fea28;})});}_0x2f5654=_[_0x215b('0x3f')]({},_0x2f5654,_0x53efe9[_0x215b('0x40')]);return _0x114ce3['getAgents'](_0x2f5654);}})['then'](function(_0x3b8c16){if(_0x3b8c16){_0x4546c5=_0x3b8c16[_0x215b('0x36')];if(!_0x53efe9[_0x215b('0x31')]['hasOwnProperty'](_0x215b('0x37'))){_0x2f5654[_0x215b('0x38')]=qs[_0x215b('0x38')](_0x53efe9['query'][_0x215b('0x38')]);_0x2f5654['offset']=qs[_0x215b('0x1e')](_0x53efe9['query']['offset']);}return _0x114ce3[_0x215b('0x72')](_0x2f5654);}})['then'](function(_0x3dbac2){if(_0x3dbac2){return _0x3dbac2?{'count':_0x4546c5,'rows':_0x3dbac2}:null;}})['then'](respondWithResult(_0x426095,null))[_0x215b('0x45')](handleError(_0x426095,null));};